public PropertyMap(PropertyMap includedMemberMap, TypeMap typeMap, LambdaExpression expression) : this(includedMemberMap, typeMap) => ApplyIncludedMemberMap(includedMemberMap, expression);
public PropertyMap(MemberInfo destinationMember, TypeMap typeMap) { TypeMap = typeMap; DestinationMember = destinationMember; }
public PropertyMap(PropertyMap inheritedMappedProperty, TypeMap typeMap) : this(inheritedMappedProperty.DestinationMember, typeMap) => ApplyInheritedPropertyMap(inheritedMappedProperty);
private static LambdaExpression GenerateTypeMapExpression(MapRequest mapRequest, TypeMap typeMap) { var mapExpression = typeMap.MapExpression; var typeMapSourceParameter = mapExpression.Parameters[0]; var typeMapDestinationParameter = mapExpression.Parameters[1]; var requestedSourceType = mapRequest.RequestedTypes.SourceType; var requestedDestinationType = mapRequest.RequestedTypes.DestinationType; if (typeMapSourceParameter.Type != requestedSourceType || typeMapDestinationParameter.Type != requestedDestinationType) { var requestedSourceParameter = Expression.Parameter(requestedSourceType, "source"); var requestedDestinationParameter = Expression.Parameter(requestedDestinationType, "typeMapDestination"); var contextParameter = Expression.Parameter(typeof(ResolutionContext), "context"); mapExpression = Expression.Lambda(ExpressionFactory.ToType(Expression.Invoke(typeMap.MapExpression, ExpressionFactory.ToType(requestedSourceParameter, typeMapSourceParameter.Type), ExpressionFactory.ToType(requestedDestinationParameter, typeMapDestinationParameter.Type), contextParameter ), mapRequest.RuntimeTypes.DestinationType), requestedSourceParameter, requestedDestinationParameter, contextParameter); } return(mapExpression); }