diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-01-31 15:55:44 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-01-31 15:55:44 +0300 |
commit | a9e52b199b0661b85ca0c7e1318c30742a1168bd (patch) | |
tree | aba504e711ddfa8beaf035af76256a367a6559f8 /Program.cs | |
parent | cdd9f9e98bb5eaf5031ad48a1989853c83fcfed0 (diff) |
Database init
Diffstat (limited to 'Program.cs')
-rw-r--r-- | Program.cs | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,9 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using MyDarling.Models; + var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddDbContext<DataContext>(opts => +{ + opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]); + opts.EnableSensitiveDataLogging(true); +}); builder.Services.AddControllersWithViews(); + var app = builder.Build(); app.UseStaticFiles(); app.MapControllers(); app.MapDefaultControllerRoute(); +var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>(); + + app.Run();
\ No newline at end of file |