public ApiServer(HttpContextBase context) { _context = context; container = ApiSetup.Builder; var config = container.Resolve <IApiConfiguration>(); var route = RouteTable.Routes.OfType <Route>().First(r => r.Url.EndsWith(config.GetBasePath() + "batch")); if (route == null) { throw new ArgumentException("Couldn't resolve api"); } var routeHandler = route.RouteHandler as ApiBatchRouteHandler; if (routeHandler == null) { throw new ArgumentException("Couldn't resolve api"); } var requestContext = new RequestContext(context, new RouteData(new Route("batch", routeHandler), routeHandler)); _batchHandler = routeHandler.GetHttpHandler(requestContext) as ApiBatchHttpHandler; if (_batchHandler == null) { throw new ArgumentException("Couldn't resolve api"); } }
public ApiServer(HttpContextBase context) { _context = context; var container = ServiceLocator.Current.GetInstance <IUnityContainer>(); var routeHandler = container.Resolve <ApiBatchRouteHandler>(); var requestContext = new RequestContext(context, new RouteData(new Route("batch", routeHandler), routeHandler)); _batchHandler = routeHandler.GetHandler(container, requestContext) as ApiBatchHttpHandler; if (_batchHandler == null) { throw new ArgumentException("Couldn't resolve api"); } }