Пример #1
0
        private Func <IDataRecord, T> CreateMapInternal <T>(Action <IMapCompilerSettings> setup)
        {
            var settings        = new CompilationSettings();
            var compilerBuilder = new MapCompilerSettings(settings);

            setup?.Invoke(compilerBuilder);
            var operation = new MapContext(Provider, typeof(T), settings);
            var map       = Context.MapCompiler.Compile <T>(operation, Reader.Reader);

            return(map);
        }
Пример #2
0
        public MapContext(IProviderConfiguration provider, Type topLevelTargetType, CompilationSettings typeSettings)
        {
            Argument.NotNull(provider, nameof(provider));
            Argument.NotNull(topLevelTargetType, nameof(topLevelTargetType));
            Argument.NotNull(typeSettings, nameof(typeSettings));

            TopLevelTargetType = topLevelTargetType;
            Settings           = typeSettings;

            IgnorePrefixes = typeSettings.IgnorePrefixes ?? new List <string>();
            Separator      = (typeSettings.Separator ?? "_").ToLowerInvariant();

            RecordParam = Expression.Parameter(typeof(IDataRecord), "record");

            Provider = provider;

            _variableNumbers = new VariableNumberSource();
        }
Пример #3
0
 public MapCompilerSettings(CompilationSettings types)
 {
     _types = types;
 }