summaryrefslogtreecommitdiff
path: root/Program.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-02-16 07:23:48 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-02-16 07:23:48 +0300
commitaf72b18ba097310f55152ee0f1654fe4df6dea89 (patch)
tree462107ea8e4e1b78c1b9e18767c10f4e66f240d4 /Program.cs
parent3e8118838b43865b9707e2c52738835fda04d48a (diff)
MyDarlingRepository DI
Diffstat (limited to 'Program.cs')
-rw-r--r--Program.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Program.cs b/Program.cs
index 7a4bd1d..2d52ee9 100644
--- a/Program.cs
+++ b/Program.cs
@@ -3,11 +3,12 @@ using MyDarling.Models;
var builder = WebApplication.CreateBuilder(args);
-builder.Services.AddDbContext<DataContext>(opts =>
+builder.Services.AddDbContext<DataContext>(opts =>
{
- opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
- opts.EnableSensitiveDataLogging(true);
+ opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
+ opts.EnableSensitiveDataLogging(true);
});
+builder.Services.AddSingleton<IRepository, MyDarlingRepository>();
builder.Services.AddControllersWithViews();
var app = builder.Build();
@@ -16,7 +17,7 @@ app.UseStaticFiles();
app.MapControllers();
app.MapDefaultControllerRoute();
-var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
-SeedData.SeedDatabase(context);
+// var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
+// SeedData.SeedDatabase(context);
app.Run(); \ No newline at end of file