Exemplo n.º 1
0
 public PathMap(PathMap pathMap, TypeMap typeMap, IncludedMember includedMember) : this(pathMap.DestinationExpression, pathMap.MemberPath, typeMap)
 {
     IncludedMember      = includedMember.Chain(pathMap.IncludedMember);
     CustomMapExpression = pathMap.CustomMapExpression;
     Condition           = pathMap.Condition;
     Ignored             = pathMap.Ignored;
 }
Exemplo n.º 2
0
        private void ApplyIncludedMemberTypeMap(IncludedMember includedMember)
        {
            var typeMap    = includedMember.TypeMap;
            var memberMaps = typeMap.PropertyMaps.
                             Where(m => m.CanResolveValue && GetPropertyMap(m) == null)
                             .Select(p => new PropertyMap(p, this, includedMember))
                             .ToList();
            var notOverridenPathMaps = NotOverridenPathMaps(typeMap);

            if (memberMaps.Count == 0 && notOverridenPathMaps.Count == 0)
            {
                return;
            }
            memberMaps.ForEach(p =>
            {
                AddPropertyMap(p);
                foreach (var transformer in typeMap.ValueTransformers)
                {
                    p.AddValueTransformation(transformer);
                }
            });
            _beforeMapActions.UnionWith(typeMap._beforeMapActions.Select(includedMember.Chain));
            _afterMapActions.UnionWith(typeMap._afterMapActions.Select(includedMember.Chain));
            notOverridenPathMaps.ForEach(p => AddPathMap(new PathMap(p, this, includedMember)
            {
                CustomMapExpression = p.CustomMapExpression
            }));
        }
Exemplo n.º 3
0
 private void ApplyMemberMaps(TypeMap currentMap, IConfigurationProvider configurationProvider)
 {
     foreach (var includedMemberExpression in currentMap.GetAllIncludedMembers())
     {
         var includedMap    = configurationProvider.GetIncludedTypeMaps(new[] { new TypePair(includedMemberExpression.Body.Type, currentMap.DestinationType) }).Single();
         var includedMember = new IncludedMember(includedMap, includedMemberExpression);
         if (currentMap.AddMemberMap(includedMember))
         {
             ApplyMemberMaps(includedMap, configurationProvider);
             foreach (var inheritedIncludedMember in includedMap.IncludedMembersTypeMaps)
             {
                 currentMap.AddMemberMap(includedMember.Chain(inheritedIncludedMember));
             }
         }
     }
 }
Exemplo n.º 4
0
 public PropertyMap(PropertyMap includedMemberMap, TypeMap typeMap, IncludedMember includedMember)
     : this(includedMemberMap, typeMap) => IncludedMember = includedMember.Chain(includedMemberMap.IncludedMember);
Exemplo n.º 5
0
 public bool AddMemberMap(IncludedMember includedMember) => _includedMembersTypeMaps.Add(includedMember);
Exemplo n.º 6
0
 public PropertyMap(
     PropertyMap includedMemberMap,
     TypeMap typeMap,
     IncludedMember includedMember
     ) : this(includedMemberMap, typeMap) =>