Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseOptions();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // Faccio la mia bella hotfix!
            app.UseCors(opt => opt
                        .WithOrigins("http://localhost:4200", "http://localhost")
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials());

            app.UseMvc(routeBuilder =>
            {
                routeBuilder.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");

                // Enable full OData queries, you might want to consider which would be actually enabled in production scenaries
                routeBuilder.Count().Filter().OrderBy().Expand().Select().MaxTop(null);

                routeBuilder.MapODataServiceRoute("ODataRoute", "odata", EdmModelBuilder.CreateModel());
            });
        }