55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using RPauth444.Data;
|
|
|
|
namespace RPauth444
|
|
{
|
|
#region snippet
|
|
public class Startup
|
|
{
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddDbContext<ApplicationDbContext>(options =>
|
|
options.UseSqlServer(
|
|
Configuration.GetConnectionString("DefaultConnection")));
|
|
services.AddDefaultIdentity<IdentityUser>()
|
|
.AddEntityFrameworkStores<ApplicationDbContext>();
|
|
|
|
services.AddMvc();
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
app.UseDatabaseErrorPage();
|
|
}
|
|
else
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseAuthentication();
|
|
|
|
app.UseMvc();
|
|
}
|
|
}
|
|
#endregion
|
|
}
|