public override object Execute(TModel model) { var proxyMethod = ProxyMethodMap.MapFor <TModel>().GetProxyMethodInfo(MethodName); var method = proxyMethod.MethodInfo; return(method.Invoke(model, Arguments)); }
internal static ProxyMethodMap Create(Type modelType) { var result = new ProxyMethodMap(modelType); result.Build(); return(result); }
internal static ProxyMethodMap MapFor(Type modelType) { ProxyMethodMap proxyMethodMap; if (!_proxyMethodMaps.TryGetValue(modelType, out proxyMethodMap)) { proxyMethodMap = ProxyMethodMap.Create(modelType); _proxyMethodMaps.Add(modelType, proxyMethodMap); } return(proxyMethodMap); }
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; } }
public ModelProxy(IEngine <TModel> handler) : base(typeof(TModel)) { _handler = handler; _proxyMethods = ProxyMethodMap.MapFor <TModel>(); }