// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); DataAccessDI.ConfigureServices(services, Configuration); BusinessLogicDI.ConfigureServices(services, Configuration); CommonDI.ConfigureServices(services, Configuration); }
// 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(); } app.UseCors("AllowAll"); DataAccessDI.ConfigureMiddleware(app); BusinessLogicDI.ConfigureMiddleware(app); CommonDI.ConfigureMiddleware(app); app.UseMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("AllowAll", builder => { builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials(); }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1) .AddJsonOptions( options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore ); DataAccessDI.ConfigureServices(services, Configuration); BusinessLogicDI.ConfigureServices(services, Configuration); CommonDI.ConfigureServices(services, Configuration); }