public IMappingExpression ReverseMap() { var reversedTypes = new TypePair(DestinationType, SourceType); var reverseMap = new MappingExpression(reversedTypes, MemberList.None) { IsReverseMap = true }; ReverseMapCore(reverseMap); reverseMap.IncludeMembers(MapToSourceMembers().Select(m => m.DestinationMember.Name).ToArray()); foreach (var includedMemberName in IncludedMembersNames) { reverseMap.ForMember(includedMemberName, m => m.MapFrom(s => s)); } return(reverseMap); }
public IMappingExpression ReverseMap() { var reversedTypes = new TypePair(Types.DestinationType, Types.SourceType); var reverseMap = new MappingExpression(reversedTypes, MemberList.None); if (!reversedTypes.IsGenericTypeDefinition) { reverseMap.MemberConfigurations.AddRange(MemberConfigurations.Select(m => m.Reverse()).Where(m => m != null)); } ReverseMapExpression = reverseMap; reverseMap.IncludeMembers(MapToSourceMembers().Select(m => m.DestinationMember.Name).ToArray()); foreach (var includedMemberName in IncludedMembersNames) { reverseMap.ForMember(includedMemberName, m => m.MapFrom(s => s)); } return(reverseMap); }