/// <summary> /// Configurations the specified application builder. /// </summary> /// <param name="appBuilder">The application builder.</param> /// <exception cref="System.ArgumentNullException"></exception> public void Configuration(IAppBuilder appBuilder) { if (appBuilder == null) { throw new ArgumentNullException(nameof(appBuilder)); } appBuilder.UseCors(CorsOptions.AllowAll); appBuilder.UseNinjectMiddleware(() => Ninject.ConfiguredKernel); appBuilder.UseNinjectWebApi(WebApi.GetConfig(OData.CreateModel())); appBuilder.Use <NotFoundMiddleware>(); }
public void Configuration(IAppBuilder app) { var config = new HttpConfiguration(); var model = OData.CreateModel(); var pathHandler = new DefaultODataPathHandler(); var routingConventions = ODataRoutingConventions.CreateDefault(); routingConventions.Insert(0, new MediaEntityStreamRoutingConvention()); var batchHandler = new DefaultODataBatchHandler(new HttpServer(config)); config.MapODataServiceRoute( routeName: "ODataService", routePrefix: "", model: model, pathHandler: pathHandler, routingConventions: routingConventions, batchHandler: batchHandler); app.UseNinjectMiddleware(Ninject.GetConfiguredKernel); app.UseNinjectWebApi(config); }