public MappingRuleSetCollection()
        {
            CreateNew = new MappingRuleSet(
                Constants.CreateNew,
                false,
                CopySourceEnumerablePopulationStrategy.Instance,
                NullDataSourceFactory.Instance,
                ExistingOrDefaultValueDataSourceFactory.Instance);

            Merge = new MappingRuleSet(
                Constants.Merge,
                true,
                MergeEnumerablePopulationStrategy.Instance,
                PreserveExistingValueDataSourceFactory.Instance,
                ExistingOrDefaultValueDataSourceFactory.Instance);

            Overwrite = new MappingRuleSet(
                Constants.Overwrite,
                true,
                OverwriteEnumerablePopulationStrategy.Instance,
                NullDataSourceFactory.Instance,
                DefaultValueDataSourceFactory.Instance);

            _ruleSets = new List <MappingRuleSet> {
                CreateNew, Merge, Overwrite
            };
        }
Пример #2
0
        private TTarget PerformMapping <TTarget>(MappingRuleSet ruleSet, TTarget target)
        {
            if (_source == null)
            {
                return(target);
            }

            RuleSet = ruleSet;

            return(PerformMapping(target));
        }
Пример #3
0
        private TTarget PerformMapping <TTarget>(MappingRuleSet ruleSet, TTarget existing)
        {
            if (_source == null)
            {
                return(existing);
            }

            RuleSet = ruleSet;

            var rootMappingData = CreateRootMappingData(existing);
            var result          = rootMappingData.MapStart();

            return((TTarget)result);
        }
Пример #4
0
        private TTarget PerformMapping <TTarget>(
            MappingRuleSet ruleSet,
            TTarget target,
            Expression <Action <IFullMappingInlineConfigurator <TSource, TTarget> > >[] configurations)
        {
            if (_source == null)
            {
                return(target);
            }

            RuleSet       = ruleSet;
            MapperContext = MapperContext.InlineContexts.GetContextFor(configurations, this);

            return(PerformMapping(target));
        }
Пример #5
0
 public MappingExecutor(MappingRuleSet ruleSet, MapperContext mapperContext)
 {
     RuleSet       = ruleSet;
     MapperContext = mapperContext;
 }