/// <summary> /// 根据方法名称,返回内部表示的调用信息。 /// </summary> /// <param name="name"></param> /// <returns></returns> public static InvokeInfo GetActionInvokeInfo(string name) { if (s_PageActionDict == null || s_PageActionDict.Count <= 0) { InitControllers(); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } ActionDescription action = null; if (s_PageActionDict.TryGetValue(name, out action) == false) { return(null); } InvokeInfo vkInfo = new InvokeInfo(); vkInfo.Business = action.Business; vkInfo.Action = action; if (vkInfo.Action.MethodInfo.IsStatic == false) { //vkInfo.Instance = Activator.CreateInstance(vkInfo.Controller.ControllerType); vkInfo.Instance = vkInfo.Business.BusinessType.FastNew(); } return(vkInfo); }
public static object ExecuteAction(string _DataContent, InvokeInfo vkInfo) { if (vkInfo == null) { throw new ArgumentNullException("vkInfo"); } // 调用方法 object result = ExecuteActionInternal(_DataContent, vkInfo); return(result); }
internal static object ExecuteActionInternal(string _DataContent, InvokeInfo info) { // 准备要传给调用方法的参数 object[] parameters = GetActionCallParameters(_DataContent, info.Action); // 调用方法 if (info.Action.HasReturn) { //return info.Action.MethodInfo.Invoke(info.Instance, parameters); return(info.Action.MethodInfo.FastInvoke(info.Instance, parameters)); } else { //info.Action.MethodInfo.Invoke(info.Instance, parameters); info.Action.MethodInfo.FastInvoke(info.Instance, parameters); return(null); } }
public static object ExecuteAction(BaseParam param, InvokeInfo vkInfo) { if (vkInfo == null) { throw new ArgumentNullException("vkInfo"); } // 调用方法 object result = ExecuteActionInternal(param, vkInfo); //// 处理方法的返回结果 //IActionResult executeResult = result as IActionResult; //if( executeResult != null ) { // executeResult.Ouput(context); //} //else { // if( result != null ) { // // 普通类型结果 // context.Response.ContentType = "text/plain"; // context.Response.Write(result.ToString()); // } //} return(result); }