本文整理汇总了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
};
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}