Exemple #1
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);
        }
Exemple #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();
        }