public ConstructionKey(IObjectMappingData mappingData)
 {
     MappingData   = mappingData;
     _ruleSet      = mappingData.MappingContext.RuleSet;
     _sourceMember = mappingData.MapperData.SourceMember;
     _targetMember = mappingData.MapperData.TargetMember;
 }
 public MapperCreationCallbackKey(
     MappingRuleSet ruleSet,
     Type sourceType,
     Type targetType)
 {
     _ruleSet    = ruleSet;
     _sourceType = sourceType;
     _targetType = targetType;
 }
Пример #3
0
 public static ExpressionInfoFinder.ExpressionInfo GetExpressionInfoFor(
     this MappingRuleSet ruleSet,
     Expression value,
     ExpressionInfoFinder infoFinder = null,
     bool targetCanBeNull            = false)
 {
     return(ruleSet.Settings?.GuardAccessTo(value) != false
         ? (infoFinder ?? ExpressionInfoFinder.Default).FindIn(value, targetCanBeNull)
         : ExpressionInfoFinder.EmptyExpressionInfo);
 }
Пример #4
0
 public BasicMapperData(
     MappingRuleSet ruleSet,
     Type sourceType,
     Type targetType,
     IQualifiedMember sourceMember,
     QualifiedMember targetMember,
     IBasicMapperData parent)
     : this(ruleSet, sourceType, targetType, targetMember, parent)
 {
     SourceMember = sourceMember;
 }
        private static Expression GetNestedAccessChecksFor(
            Expression value,
            MappingRuleSet ruleSet,
            IMemberMapperData mapperData)
        {
            if (ruleSet.Settings?.GuardAccessTo(value) == false)
            {
                return(null);
            }

            return(NestedAccessChecksFactory.GetNestedAccessChecksFor(value, mapperData));
        }
Пример #6
0
 public BasicMapperData(
     MappingRuleSet ruleSet,
     Type sourceType,
     Type targetType,
     QualifiedMember targetMember,
     IBasicMapperData parent = null)
 {
     IsRoot       = parent == null;
     _parent      = parent;
     SourceType   = sourceType;
     TargetType   = targetType;
     RuleSet      = ruleSet;
     TargetMember = targetMember ?? QualifiedMember.All;
 }
        private MappingPlan GetMappingPlan <TTarget>(
            MappingRuleSet ruleSet,
            ICollection <Expression <Action <IFullMappingInlineConfigurator <TSource, TTarget> > > > configurations)
        {
            var planContext = new SimpleMappingContext(ruleSet, _mapperContext)
            {
                IgnoreUnsuccessfulMemberPopulations = false
            };

            return(GetMappingPlan(
                       planContext,
                       ObjectMappingDataFactory.ForRootFixedTypes <TSource, TTarget>,
                       configurations));
        }
 public QualifiedMemberContext(
     MappingRuleSet ruleSet,
     Type sourceType,
     Type targetType,
     IQualifiedMember sourceMember,
     QualifiedMember targetMember,
     IQualifiedMemberContext parent,
     MapperContext mapperContext)
     : this(
         ruleSet,
         sourceType,
         targetType,
         targetMember,
         parent,
         mapperContext)
 {
     SourceMember = sourceMember.SetContext(this);
 }
        private static MapperContext ConfigureMapperContext <TConfigurator>(
            IEnumerable <Expression <Action <TConfigurator> > > configurations,
            Func <MappingConfigInfo, TConfigurator> configuratorFactory,
            MappingRuleSet ruleSet,
            MapperContext mapperContext)
        {
            var configInfo = new MappingConfigInfo(mapperContext)
                             .ForRuleSet(ruleSet)
                             .ForSourceType <TSource>()
                             .ForTargetType <TTarget>();

            var configurator = configuratorFactory.Invoke(configInfo);

            foreach (var configuration in configurations)
            {
                configuration.Compile().Invoke(configurator);
            }

            return(mapperContext);
        }
 protected MemberMapperDataBase(
     MappingRuleSet ruleSet,
     IQualifiedMember sourceMember,
     QualifiedMember targetMember,
     ObjectMapperData parent,
     MapperContext mapperContext)
     : base(
         ruleSet,
         sourceMember.Type,
         targetMember.Type,
         sourceMember,
         targetMember,
         parent,
         mapperContext)
 {
     Parent            = parent;
     MappingDataObject = CreateMappingDataObject();
     MappingDataType   = typeof(IMappingData <,>).MakeGenericType(SourceType, TargetType);
     SourceObject      = GetMappingDataProperty(MappingDataType, Member.RootSourceMemberName);
     TargetObject      = GetMappingDataProperty(Member.RootTargetMemberName);
 }
        public QualifiedMemberContext(
            MappingRuleSet ruleSet,
            Type sourceType,
            Type targetType,
            QualifiedMember targetMember,
            IQualifiedMemberContext parent,
            MapperContext mapperContext)
        {
            if (parent == null)
            {
                IsRoot = true;
            }
            else
            {
                _parent = parent;
            }

            SourceType    = sourceType;
            TargetType    = targetType;
            RuleSet       = ruleSet;
            MapperContext = mapperContext;
            TargetMember  = (targetMember?.SetContext(this)) ?? QualifiedMember.All;
        }
Пример #12
0
 public MappingConfigInfo ForRuleSet(string ruleSetName)
 {
     _mappingRuleSet = MapperContext.RuleSets.GetByName(ruleSetName);
     return(this);
 }
 public static Expression GetNestedAccessChecksFor(this MappingRuleSet ruleSet, Expression value)
 => GetNestedAccessChecksFor(value, ruleSet, mapperData: null);
Пример #14
0
 private RootObjectMapperKey(MappingRuleSet ruleSet, MappingTypes mappingTypes, MapperContext mapperContext)
     : base(mappingTypes)
 {
     _mapperContext = mapperContext;
     _ruleSet       = ruleSet;
 }
Пример #15
0
        private string GetMappingPlan <TTarget>(MappingRuleSet ruleSet)
        {
            var planContext = new MappingExecutor <TSource>(ruleSet, _mapperContext);

            return(new MappingPlan <TSource, TTarget>(planContext));
        }
Пример #16
0
 public SimpleMappingContext(MappingRuleSet ruleSet, MapperContext mapperContext)
 {
     RuleSet       = ruleSet;
     MapperContext = mapperContext;
 }
Пример #17
0
 public MappingConfigInfo ForRuleSet(MappingRuleSet ruleSet)
 {
     RuleSet = ruleSet;
     return(this);
 }
Пример #18
0
 public bool Supports(MappingRuleSet ruleSet)
 => ruleSet.Settings?.ExpressionIsSupported(_lambda) != false;
Пример #19
0
 public RootObjectMapperKey(MappingRuleSet ruleSet, MappingTypes mappingTypes, IMembersSource membersSource)
     : base(mappingTypes)
 {
     _membersSource = membersSource;
     RuleSet        = ruleSet;
 }
Пример #20
0
 public bool ConditionSupports(MappingRuleSet ruleSet) => _conditionLambda.Supports(ruleSet);
 public SimpleMappingContext(MappingRuleSet ruleSet, MapperContext mapperContext)
 {
     MapperContext = mapperContext;
     RuleSet       = ruleSet;
     IgnoreUnsuccessfulMemberPopulations = true;
 }
Пример #22
0
 public bool IsFor(MappingRuleSet mappingRuleSet)
 => (RuleSet == _allRuleSets) || (mappingRuleSet == _allRuleSets) || (mappingRuleSet == RuleSet);
Пример #23
0
 public bool IsFor(MappingRuleSet mappingRuleSet)
 => (RuleSet == All) || (mappingRuleSet == All) || (mappingRuleSet == RuleSet);