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

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

            result.Build();
            return(result);
        }
Exemple #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);
        }
Exemple #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;
     }
 }
Exemple #5
0
 public ModelProxy(IEngine <TModel> handler)
     : base(typeof(TModel))
 {
     _handler      = handler;
     _proxyMethods = ProxyMethodMap.MapFor <TModel>();
 }