using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using RPauth.Data; namespace RPauth { #region snippet public class Startup { public Startup(IConfiguration configuration, IWebHostEnvironment env) { Environment = env; Configuration = configuration; } public IConfiguration Configuration { get; } public IWebHostEnvironment Environment { get; } public void ConfigureServices(IServiceCollection services) { if (Environment.IsDevelopment()) { services.AddDbContext(options => options.UseSqlite( Configuration.GetConnectionString("RazorPagesMovieContext"))); } else { services.AddDbContext(options => options.UseSqlServer( Configuration.GetConnectionString("MovieContext"))); } services.AddRazorPages(); } public void Configure(IApplicationBuilder app) { if (Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); } } #endregion }