예제 #1
0
        public override object Execute(TModel model)
        {
            var proxyMethod = ProxyMethodMap.MapFor <TModel>().GetProxyMethodInfo(MethodName);
            var method      = proxyMethod.MethodInfo;

            return(method.Invoke(model, Arguments));
        }
예제 #2
0
        internal static ProxyMethodMap Create(Type modelType)
        {
            var result = new ProxyMethodMap(modelType);

            result.Build();
            return(result);
        }
예제 #3
0
        internal static ProxyMethodMap MapFor(Type modelType)
        {
            ProxyMethodMap proxyMethodMap;

            if (!_proxyMethodMaps.TryGetValue(modelType, out proxyMethodMap))
            {
                proxyMethodMap = ProxyMethodMap.Create(modelType);
                _proxyMethodMaps.Add(modelType, proxyMethodMap);
            }
            return(proxyMethodMap);
        }
예제 #4
0
 public override object Execute(TModel model)
 {
     try
     {
         var        proxyMethod = ProxyMethodMap.MapFor <TModel>().GetProxyMethodInfo(MethodName);
         MethodInfo methodInfo  = proxyMethod.MethodInfo;
         return(methodInfo.Invoke(model, Arguments));
     }
     catch (TargetInvocationException ex)
     {
         throw ex.InnerException;
     }
 }
예제 #5
0
 public ModelProxy(IEngine <TModel> handler)
     : base(typeof(TModel))
 {
     _handler      = handler;
     _proxyMethods = ProxyMethodMap.MapFor <TModel>();
 }