Esempio n. 1
0
        internal MemberConfigurationExpression ForMember(MemberInfo destinationProperty, Action <IMemberConfigurationExpression> memberOptions)
        {
            var expression = new MemberConfigurationExpression(destinationProperty, Types.SourceType);

            MemberConfigurations.Add(expression);

            memberOptions(expression);

            return(expression);
        }
Esempio n. 2
0
        internal static IPropertyMapConfiguration Create(LambdaExpression destination, LambdaExpression source)
        {
            if (destination == null || !destination.IsMemberPath())
            {
                return(null);
            }
            var reversed = new PathConfigurationExpression <TSource, TDestination, object>(destination);

            if (reversed.MemberPath.Length == 1)
            {
                var reversedMemberExpression = new MemberConfigurationExpression <TSource, TDestination, object>(reversed.DestinationMember, typeof(TSource));
                reversedMemberExpression.MapFromUntyped(source);
                return(reversedMemberExpression);
            }
            reversed.MapFromUntyped(source);
            return(reversed);
        }