Beispiel #1
0
        public override object Execute(T model)
        {
            var proxyMethod = MethodMap.MapFor <T>().GetOperationInfo(MethodName);
            var method      = proxyMethod.MethodInfo;

            if (method.IsGenericMethod)
            {
                method = method.MakeGenericMethod(GenericTypeArguments);
            }
            return(method.Invoke(model, Arguments));
        }
Beispiel #2
0
        internal static MethodMap <T> MapFor <T>() where T : Model
        {
            Type      type = typeof(T);
            MethodMap methodMap;

            if (!MethodMaps.TryGetValue(type, out methodMap))
            {
                methodMap = MethodMap <T> .Create(type);

                MethodMaps.Add(type, methodMap);
            }
            return((MethodMap <T>)methodMap);
        }
Beispiel #3
0
 public override object Execute(TModel model)
 {
     try
     {
         var proxyMethod = MethodMap.MapFor <TModel>().GetOperationInfo(MethodName);
         var methodInfo  = proxyMethod.MethodInfo;
         if (methodInfo.IsGenericMethod)
         {
             methodInfo = methodInfo.MakeGenericMethod(GenericTypeArguments);
         }
         return(methodInfo.Invoke(model, Arguments));
     }
     catch (TargetInvocationException ex)
     {
         throw ex.InnerException;
     }
 }
Beispiel #4
0
 public Proxy(IEngine <T> handler)
     : base(typeof(T))
 {
     _handler = handler;
     _methods = MethodMap.MapFor <T>();
 }