/// <summary> /// Creates and executes the specified controller. /// </summary> /// <param name="controllerMetaData">Type of the controller.</param> /// <param name="resolver">The DI container resolver.</param> /// <param name="context">The context.</param> /// <param name="routeParameters">The route parameters.</param> /// <returns></returns> public async Task <ControllerResponseResult> Execute(IControllerMetaData controllerMetaData, IDIResolver resolver, HttpContext context, dynamic?routeParameters = null) { ControllerResponse?response = null; var controller = _controllerFactory.CreateController(controllerMetaData.ControllerType, resolver, context, routeParameters); switch (controller) { case SyncControllerBase syncController: { response = syncController.Invoke(); break; } case AsyncControllerBase asyncController: { response = await asyncController.Invoke(); break; } } if (response == null) { return(ControllerResponseResult.Default); } _controllerResponseBuilder.BuildControllerResponseProperties(response, resolver); return(await response.Process()); }
private ControllerResponseResult ProcessControllerResponse(ControllerResponse response, IDIResolver resolver) { if (response == null) return ControllerResponseResult.Default; _controllerResponseBuilder.BuildControllerResponseProperties(response, resolver); return response.Process(); }
private ControllerResponseResult ProcessControllerResponse(ControllerResponse response, IDIContainerProvider containerProvider) { if (response == null) { return(ControllerResponseResult.Default); } _controllerResponseBuilder.BuildControllerResponseProperties(response, containerProvider); return(response.Process()); }