Esempio n. 1
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            IServiceAwareController controller = actionContext.ControllerContext.Controller as IServiceAwareController;

            if (controller != null)
            {
                controller.RegisterDisposableServices(((IServiceAwareController)controller).DisposableServices);
            }
        }
        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            // pre-processing

            IServiceAwareController controller = actionContext.ControllerContext.Controller as IServiceAwareController;

            if (controller != null)
            {
                controller.RegisterDisposableServices(controller.DisposableServices);
            }
        }
Esempio n. 3
0
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            IServiceAwareController controller = actionExecutedContext.ActionContext.ControllerContext.Controller as IServiceAwareController;

            if (controller != null)
            {
                foreach (var service in controller.DisposableServices)
                {
                    if (service != null && service is IDisposable)
                    {
                        (service as IDisposable).Dispose();
                    }
                }
            }
        }