// 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.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/v1/Error"); } app.UseHttpsRedirection(); app.UseMvc(); app.UseAuthentication(); // Verify the create of the database using (var db = new IncrementorDBContext()) { if (!db.Database.EnsureCreated()) { throw new InvalidOperationException("An error occured while creating the database. Please ensure that the Connection String and Database Type are valid."); } } }
public IncrementorService(IncrementorDBContext db) { this.Db = db; }