// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseCors(MyAllowSpecificOrigins); app.UseHttpsRedirection(); app.UseMvc(routeBuilder => { // Get the OData model var odataModel = DbContextTrinity.GetEdmModel(); routeBuilder.EnableDependencyInjection(); routeBuilder.Select().Filter().OrderBy().Expand().Count().MaxTop(10); routeBuilder.MapODataServiceRoute( "odata", "odata", odataModel, new DefaultODataBatchHandler() ); }); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseCors("CorsConfig"); app.UseAuthorization(); app.UseEndpoints(endpoints => { var odataModel = DbContextTrinity.GetEdmModel(); endpoints.MapControllers(); endpoints.EnableDependencyInjection(); endpoints.Select().Filter().OrderBy().Expand().Count().MaxTop(10); endpoints.MapODataRoute("odata", "odata", odataModel, new DefaultODataBatchHandler()); }); }