Example #1
0
            private static Expression PrimitiveToPrimitive(MapperContext context, Expression destination,
                                                           Expression source, Mapping.MemberMapInfo memberMapInfo)
            {
                var converter = memberMapInfo.TypeConverter;

                if (converter == null)
                {
                    throw GetCompileException(CreateMemberMapping_PrimitiveToPrimitive_TypeConverterIsNull);
                }

                return(converter.CreateInlineConvertExpression(source, memberMapInfo.DestinationMember.Type));
            }
Example #2
0
            private static Expression CreateMemberMapping(MapperContext context, Expression destination,
                                                          Expression source, Mapping.MemberMapInfo memberMapInfo)
            {
                switch (memberMapInfo.MemberMapType)
                {
                case Mapping.MemberMapType.PrimitiveToPrimitive:
                {
                    return(PrimitiveToPrimitive(context, destination, source, memberMapInfo));
                }

                case Mapping.MemberMapType.DestinationFromExpression:
                {
                    return(DestinationFromExpression(context, destination, source, memberMapInfo));
                }

                case Mapping.MemberMapType.DestinationFromValueResolver:
                {
                    return(DestinationFromValueResolver(context, destination, source, memberMapInfo));
                }

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
Example #3
0
 private static Expression DestinationFromValueResolver(MapperContext context, Expression destination,
                                                        Expression source,
                                                        Mapping.MemberMapInfo memberMapInfo)
 {
     return(null);
 }