// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); ServiceFactory factory = new ServiceFactory(services); factory.AddCustomServices(); factory.AddDbContextService(this.Configuration.GetConnectionString("Obl1DB")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(options => options.Filters.Add(typeof(ExceptionFilter))); ServiceFactory serviceFactory = new ServiceFactory(services); serviceFactory.AddDbContextService(); serviceFactory.AddCustomServices(); services.AddScoped <AuthorizationDIFilter>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); AddSwagger(services); ServiceFactory factory = new ServiceFactory(services); factory.AddCustomServices(); factory.AddDbContextService(); services.AddScoped <AuthorizationAttributeFilter>(); services.EnableAllCors(); }
// 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(cors, builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); }); services.AddControllers(options => options.Filters.Add(typeof(ExceptionFilter))); ServiceFactory factory = new ServiceFactory(services); factory.AddDbContextService(); factory.AddCustomerServices(); }