-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
27 lines (19 loc) · 691 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using CNRBShop.DbContexts;
using CNRBShop.Services.Implementations;
using CNRBShop.Services.Interfaces;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IProductRepository, ProductRepository>();
// Serilog, logging, repository
builder.Services.AddControllersWithViews();
// db context
builder.Services.AddDbContext<CNRBShopDbContext>(options =>
options.UseSqlite(builder.Configuration["ConnectionStrings:CNRBShopDb123ConnectionString"]));
var app = builder.Build();
app.UseStaticFiles();
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.MapDefaultControllerRoute();
app.Run();