Exemple #1
0
        public IPropertyMapConfiguration Reverse()
        {
            var destinationType = DestinationMember.DeclaringType;

            if (_sourceMembers != null)
            {
                if (_sourceMembers.Length > 1)
                {
                    return(null);
                }
                var reversedMemberConfiguration = new MemberConfigurationExpression <
                    TDestination,
                    TSource,
                    object
                    >(_sourceMembers[0], destinationType);
                reversedMemberConfiguration.MapFrom(DestinationMember.Name);
                return(reversedMemberConfiguration);
            }
            if (destinationType.IsGenericTypeDefinition) // .ForMember("InnerSource", o => o.MapFrom(s => s))
            {
                return(null);
            }
            return(PathConfigurationExpression <TDestination, TSource, object> .Create(
                       SourceExpression,
                       GetDestinationExpression()
                       ));
        }
        public IPropertyMapConfiguration Reverse()
        {
            var newSource           = Parameter(DestinationMember.DeclaringType, "source");
            var newSourceProperty   = MakeMemberAccess(newSource, _destinationMember);
            var newSourceExpression = Lambda(newSourceProperty, newSource);

            return(PathConfigurationExpression <TDestination, TSource> .Create(_sourceMember, newSourceExpression));
        }
        public IPropertyMapConfiguration Reverse()
        {
            var newSourceExpression = MemberAccessLambda(DestinationMember);

            return(PathConfigurationExpression <TDestination, TSource, object> .Create(_sourceMember, newSourceExpression));
        }
Exemple #4
0
 public IPropertyMapConfiguration Reverse() =>
 PathConfigurationExpression <TDestination, TSource, object> .Create(_sourceMember, GetDestinationExpression());