internal void DecrementTypeDepth(TypePair types) { TypeDepth[types]--; }
internal void IncrementTypeDepth(TypePair types) { TypeDepth[types]++; }
public bool IsConventionMap(TypePair types) => TypeConfigurations.Any(c => c.IsMatch(types));
public TypeMap CreateClosedGenericTypeMap(ITypeMapConfiguration openMapConfig, TypePair closedTypes, IConfigurationProvider configurationProvider) { var closedMap = _typeMapFactory.CreateTypeMap(closedTypes.SourceType, closedTypes.DestinationType, this); closedMap.IsClosedGeneric = true; openMapConfig.Configure(closedMap); Configure(closedMap, configurationProvider); if (closedMap.TypeConverterType != null) { var typeParams = (openMapConfig.SourceType.IsGenericTypeDefinition() ? closedTypes.SourceType.GetGenericArguments() : new Type[0]) .Concat (openMapConfig.DestinationType.IsGenericTypeDefinition() ? closedTypes.DestinationType.GetGenericArguments() : new Type[0]); var neededParameters = closedMap.TypeConverterType.GetGenericParameters().Length; closedMap.TypeConverterType = closedMap.TypeConverterType.MakeGenericType(typeParams.Take(neededParameters).ToArray()); } if (closedMap.DestinationTypeOverride?.IsGenericTypeDefinition() == true) { var neededParameters = closedMap.DestinationTypeOverride.GetGenericParameters().Length; closedMap.DestinationTypeOverride = closedMap.DestinationTypeOverride.MakeGenericType(closedTypes.DestinationType.GetGenericArguments().Take(neededParameters).ToArray()); } return(closedMap); }
public MapRequest(TypePair requestedTypes, TypePair runtimeTypes, IMemberMap memberMap = null) : this(requestedTypes, runtimeTypes, new MapperConfiguration.DefaultTypeMapConfig(requestedTypes), memberMap) { }