Beispiel #1
0
#pragma warning restore CS3016 // Arrays as attribute arguments is not CLS-compliant
        static void Init()
        {
            var expr = ConvertBuilder.GetConverter(null, typeof(TFrom), typeof(TTo));

            _expression = (Expression <Func <TFrom, TTo> >)expr.Item1;

            var rexpr = (Expression <Func <TFrom, TTo> >)ConvertReducer.ReducerVisitor.Transform(expr.Item1);

            _lambda = rexpr.CompileExpression();
        }
Beispiel #2
0
        static void Init()
        {
            var expr = ConvertBuilder.GetConverter(null, typeof(TFrom), typeof(TTo));

            _expression = (Expression <Func <TFrom, TTo> >)expr.Item1;

            var rexpr = (Expression <Func <TFrom, TTo> >)expr.Item1.Transform(e => e is DefaultValueExpression ? e.Reduce() : e);

            _lambda = rexpr.Compile();
        }
Beispiel #3
0
        public LambdaInfo Create(MappingSchema mappingSchema, Type from, Type to)
        {
            var ex  = ConvertBuilder.GetConverter(mappingSchema, from, to);
            var lm  = ex.Item1.Compile();
            var ret = new LambdaInfo(ex.Item1, ex.Item2, lm, ex.Item3);

            Set(_expressions, from, to, ret);

            return(ret);
        }
Beispiel #4
0
 /// <summary>
 /// Returns type, to which provided enumeration values should be mapped.
 /// </summary>
 /// <param name="mappingSchema">Current mapping schema</param>
 /// <param name="enumType">Enumeration type.</param>
 /// <returns>Underlying mapping type.</returns>
 public static Type?GetDefaultMappingFromEnumType(MappingSchema mappingSchema, Type enumType)
 {
     return(ConvertBuilder.GetDefaultMappingFromEnumType(mappingSchema, enumType));
 }