当前位置: 首页>>代码示例>>C#>>正文


C# TypeMap.GetPropertyMaps方法代码示例

本文整理汇总了C#中AutoMapper.TypeMap.GetPropertyMaps方法的典型用法代码示例。如果您正苦于以下问题:C# TypeMap.GetPropertyMaps方法的具体用法?C# TypeMap.GetPropertyMaps怎么用?C# TypeMap.GetPropertyMaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AutoMapper.TypeMap的用法示例。


在下文中一共展示了TypeMap.GetPropertyMaps方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: X

 public static IEnumerable<MapVisual> X(TypeMap map)
 {
     foreach (var propertyMap in map.GetPropertyMaps())
     {
         yield return new MapVisual
         {
             SourceSystem = extractSystem(propertyMap.SourceMember),
             SourceValue = getValue(propertyMap.SourceMember),
             TargetSystem = extractSystem(propertyMap.DestinationProperty),
             TargetValue = propertyMap.DestinationProperty.Name
         };
     }
 }
开发者ID:InfiniteComputingSystems,项目名称:Test,代码行数:13,代码来源:VisualizeMappings.cs

示例2: ApplyInheritedTypeMap

        private void ApplyInheritedTypeMap(TypeMap inheritedTypeMap)
        {
            foreach (var inheritedMappedProperty in inheritedTypeMap.GetPropertyMaps().Where(m => m.IsMapped()))
            {
                var conventionPropertyMap = GetPropertyMaps()
                    .SingleOrDefault(m =>
                        m.DestinationProperty.Name == inheritedMappedProperty.DestinationProperty.Name);

                if (conventionPropertyMap != null && inheritedMappedProperty.HasCustomValueResolver && !conventionPropertyMap.HasCustomValueResolver)
                {
                    conventionPropertyMap.AssignCustomValueResolver(
                        inheritedMappedProperty.GetSourceValueResolvers().First());
                    conventionPropertyMap.AssignCustomExpression(inheritedMappedProperty.CustomExpression);
                }
                else if (conventionPropertyMap == null)
                {
                    var propertyMap = new PropertyMap(inheritedMappedProperty);

                    AddInheritedPropertyMap(propertyMap);
                }
            }

            //Include BeforeMap
            if (inheritedTypeMap.BeforeMap != null)
                AddBeforeMapAction(inheritedTypeMap.BeforeMap);
            //Include AfterMap
            if (inheritedTypeMap.AfterMap != null)
                AddAfterMapAction(inheritedTypeMap.AfterMap);
        }
开发者ID:DeanMilojevic,项目名称:AutoMapper,代码行数:29,代码来源:TypeMap.cs

示例3: ApplyInheritedTypeMap

        private void ApplyInheritedTypeMap(TypeMap inheritedTypeMap)
        {
            foreach (var inheritedMappedProperty in inheritedTypeMap.GetPropertyMaps().Where(m => m.IsMapped()))
            {
                var conventionPropertyMap = GetPropertyMaps()
                    .SingleOrDefault(m =>
                        m.DestinationProperty.Name == inheritedMappedProperty.DestinationProperty.Name);

                if (conventionPropertyMap != null)
                {
                    conventionPropertyMap.ApplyInheritedPropertyMap(inheritedMappedProperty);
                }
                else
                {
                    var propertyMap = new PropertyMap(inheritedMappedProperty, this);

                    _inheritedMaps.Add(propertyMap);
                }
            }

            //Include BeforeMap
            foreach (var beforeMapAction in inheritedTypeMap._beforeMapActions)
            {
                AddBeforeMapAction(beforeMapAction);
            }
            //Include AfterMap
            foreach (var afterMapAction in inheritedTypeMap._afterMapActions)
            {
                AddAfterMapAction(afterMapAction);
            }
        }
开发者ID:jbogard,项目名称:AutoMapper,代码行数:31,代码来源:TypeMap.cs

示例4: Configure

        private void Configure(TypeMapRegistry typeMapRegistry, TypeMap typeMap)
        {
            foreach (var action in AllTypeMapActions)
            {
                var expression = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList);

                action(typeMap, expression);

                expression.Configure(typeMap);
            }

            foreach (var action in AllPropertyMapActions)
            {
                foreach (var propertyMap in typeMap.GetPropertyMaps())
                {
                    var memberExpression = new MappingExpression.MemberConfigurationExpression(propertyMap.DestinationProperty, typeMap.SourceType);

                    action(propertyMap, memberExpression);

                    memberExpression.Configure(typeMap);
                }
            }

            ApplyBaseMaps(typeMapRegistry, typeMap, typeMap);
            ApplyDerivedMaps(typeMapRegistry, typeMap, typeMap);
        }
开发者ID:GeertVL,项目名称:AutoMapper,代码行数:26,代码来源:ProfileMap.cs

示例5: CheckPropertyMaps

        private void CheckPropertyMaps(ICollection<TypeMap> typeMapsChecked, TypeMap typeMap, ResolutionContext context)
        {
            foreach (var propertyMap in typeMap.GetPropertyMaps())
            {
                if (propertyMap.Ignored) continue;

                var sourceType = propertyMap.SourceType;

                if (sourceType == null) continue;

                // when we don't know what the source type is, bail
                if (sourceType.IsGenericParameter || sourceType == typeof (object))
                    return;

                var destinationType = propertyMap.DestinationProperty.GetMemberType();
                var memberTypeMap = _config.ResolveTypeMap(sourceType,
                    destinationType);

                if (typeMapsChecked.Any(tm => Equals(tm, memberTypeMap)))
                    continue;

                DryRunTypeMap(typeMapsChecked, new TypePair(sourceType, destinationType), memberTypeMap, context);
            }
        }
开发者ID:GeertVL,项目名称:AutoMapper,代码行数:24,代码来源:ConfigurationValidator.cs


注:本文中的AutoMapper.TypeMap.GetPropertyMaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。