Пример #1
0
        protected override void InitializeRecursiveMappings()
        {
            var mapMethod =
                typeof(Mapper).GetMethods()
                .First(mi => mi.Name == "Map" && mi.GetParameters().Length == 1)
                .MakeGenericMethod(typeof(T), typeof(TN));

            RecursiveExpressionResult.Add(Expression.Assign(DestFakeParameter, Expression.Call(mapMethod, SourceParameter)));
        }
Пример #2
0
        protected override void InitializeRecursiveMappings(IMappingServiceProvider serviceProvider)
        {
            var mapMethod =
                typeof(IMappingServiceProvider).GetMethods()
                .First(mi => mi.Name == MapStr && mi.GetParameters().Length == 2)
                .MakeGenericMethod(typeof(T), typeof(TN));

            var methodCall = Expression.Call(Expression.Constant(serviceProvider), mapMethod, SourceParameter, DestFakeParameter);

            RecursiveExpressionResult.Add(Expression.Assign(DestFakeParameter, methodCall));
        }