// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, WineCellarDBContext wcConext) { // 2020/10/21 - Move applying migrations to only happen in 'Developement' environment. //--wcConext.Database.Migrate( ); if (env.IsDevelopment( )) { wcConext.Database.Migrate( ); app.UseDeveloperExceptionPage( ); } app.UseHttpsRedirection( ); app.UseRouting( ); app.UseAuthorization( ); // 2020/12/10 - Add Swashbuckle service to auto-generate API documentation. app.UseSwagger( ); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "WineCellar API v1"); }); app.UseEndpoints(endpoints => { endpoints.MapControllers( ); }); }
public BottleSizeController(WineCellarDBContext context, ILogger <BottleSizeController> logger) { _context = context; _logger = logger; _converter = new BottleSizeConverter(_context); }
public WineController(WineCellarDBContext context, ILogger <WineController> logger) { _context = context; _logger = logger; _converter = new WineConverter(_context); }
public VarietalController(WineCellarDBContext context, ILogger <VarietalController> logger) { _context = context; _logger = logger; _converter = new VarietalConverter(_context); }
public WineryControllerTests() { // Create inMemory database for testing. _optionsBuilder = new DbContextOptionsBuilder <WineCellarDBContext>( ); _optionsBuilder.UseInMemoryDatabase("WineryUnitTestInMemDB"); _dbContext = new WineCellarDBContext(_optionsBuilder.Options); // Create commands controller for testing. _controller = new WineryController(_dbContext, new NullLogger <WineryController>( )); }
public BottleSizeConverter(WineCellarDBContext context) => _context = context;
public WineConverter(WineCellarDBContext context) => _context = context;
public VarietalConverter(WineCellarDBContext context) => _context = context;