private void OnExecute(IActionResultHandler resultHandler) { try { if (FilterExecuting()) { try { Result = Handler.Invoke(Controller, HttpContext, ActionHandlerFactory, Parameters); } catch (Exception error) { Exception = error; } finally { FilterExecuted(); } if (Exception != null) { resultHandler.Error(Exception); } else { resultHandler.Success(Result); } } } catch (Exception e_) { resultHandler.Error(e_); } }
private async void OnAsyncExecute(IActionResultHandler resultHandler) { HttpContext.Server.RequestExecting(); try { if (FilterExecuting()) { try { var task = (Task)Handler.Invoke(Controller, HttpContext, ActionHandlerFactory, Parameters); await task; if (Handler.PropertyHandler != null) { Result = Handler.PropertyHandler.Get(task); } else { Result = null; } } catch (Exception error) { Exception = error; } finally { FilterExecuted(); } } if (Exception != null) { Handler.IncrementError(); resultHandler.Error(Exception); } else { resultHandler.Success(Result); } } catch (Exception e_) { Handler.IncrementError(); resultHandler.Error(e_); } finally { HttpContext.Server.RequestExecuted(); } }
public void Execute(IHttpContext context, IActionResultHandler handler, ValidationBase validation, ParameterInfo parameterInfo) { ActionResult actionResult = new ActionResult(validation.Code, validation.GetResultMessage(parameterInfo.Name)); handler.Success(actionResult); }