summaryrefslogtreecommitdiff
path: root/Program.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-01-31 15:55:44 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-01-31 15:55:44 +0300
commita9e52b199b0661b85ca0c7e1318c30742a1168bd (patch)
treeaba504e711ddfa8beaf035af76256a367a6559f8 /Program.cs
parentcdd9f9e98bb5eaf5031ad48a1989853c83fcfed0 (diff)
Database init
Diffstat (limited to 'Program.cs')
-rw-r--r--Program.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Program.cs b/Program.cs
index 8f6a7b7..91c4c5d 100644
--- a/Program.cs
+++ b/Program.cs
@@ -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