Some Configuration for this Project
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
using Francesco.Recipes.World.Data;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serilog;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var services = builder.Services;
|
||||
var configuration = builder.Configuration;
|
||||
|
||||
services.AddLogging(
|
||||
loggingBuilder =>
|
||||
loggingBuilder.AddSerilog(
|
||||
new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger()));
|
||||
|
||||
|
||||
var connectionString = builder.Configuration.GetConnectionString("FrancescosRecipesWorldDbContextConnection")
|
||||
?? throw new InvalidOperationException("Connection string 'RecruitmentToolDbContextConnection' not found.");
|
||||
services.AddDbContext<FrancescosRecipesWorldDbContext>(options =>
|
||||
options.UseSqlServer(connectionString));
|
||||
|
||||
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<FrancescosRecipesWorldDbContext>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
@@ -18,9 +40,12 @@ app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapDefaultControllerRoute();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
Reference in New Issue
Block a user