public GenericRepository(TemperatureDbContext context) { if (context == null) { throw new ArgumentException("An instance of DbContext is required to use this repository.", "context"); } this.Context = context; this.DbSet = this.Context.Set <T>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, TemperatureDbContext dbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); dbContext.Database.Migrate(); } //app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public TemperatureController(TemperatureDbContext context) { _context = context; }