Value invoke() => invokeable.Invoke(new Arguments());
public HttpResponse Handle(HttpRequest request) { this.getParams = GetGetParams(request.Url); this.postParams = GetPostParams(request.Content); this.requestMethod = request.Method.ToString(); ParseContrAndActionName(request.Url); MethodInfo method = GetMethod(); IEnumerable <ParameterInfo> parameters = method.GetParameters(); this.methodParams = new object[parameters.Count()]; int index = 0; foreach (ParameterInfo parameter in parameters) { if (parameter.ParameterType.IsPrimitive) { object value = this.getParams[parameter.Name]; this.methodParams[index] = Convert.ChangeType( value, parameter.ParameterType); index++; } else if (parameter.ParameterType == typeof(HttpRequest)) { this.methodParams[index] = request; index++; } else if (parameter.ParameterType == typeof(HttpSession)) { this.methodParams[index] = request.Session; index++; } else { Type bindingModelType = parameter.ParameterType; object bindingModel = Activator .CreateInstance(bindingModelType); PropertyInfo[] properties = bindingModelType.GetProperties(); foreach (PropertyInfo property in properties) { property.SetValue( bindingModel, Convert.ChangeType( postParams[property.Name], property.PropertyType) ); } this.methodParams[index] = Convert.ChangeType( bindingModel, bindingModelType); index++; } } IInvokeable actionResult = (IInvokeable)this.GetMethod() .Invoke(this.GetController(), this.methodParams); string content = actionResult.Invoke(); HttpResponse response = new HttpResponse() { StatusCode = ResponseStatusCode.Ok, ContentAsUTF8 = content }; return(response); }