// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); var dbSetting = new MongoClientOptions(); Configuration.GetSection(nameof(MongoClientOptions)).Bind(dbSetting); IOC ioc = new IOC(); ioc.RegisterServices(services, dbSetting); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { MappingConfig.RegisterAutoMapperProfiles(services); services.AddControllers(); services.AddCors(options => { options.AddPolicy("AllowAll", builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); }); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "Library API V1", Version = "v1" }); }); services.AddDbContext <LibraryContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:LibraryDbConnectionString"])); IOC.RegisterServices(services); }