Ejemplo n.º 1
0
        public static void DynamicMapFrom <TSource, TDestination, TMember>(this IMemberConfigurationExpression <TSource, TDestination, TMember> xExpression, Type xSelectedPropertyType, LambdaExpression xMapExpression)
        {
            MethodInfo method  = xExpression.GetType().GetMethods().Where(m => m.Name == "MapFrom").FirstOrDefault(f => f.GetParameters().Any(a => a.Name.Equals("mapExpression")));
            MethodInfo generic = method.MakeGenericMethod(xSelectedPropertyType);

            generic.Invoke(xExpression, new object[] { xMapExpression });
        }