/
daniilsavchenko
/
StockFlow
Обзор
Документация
Войти
/
daniilsavchenko
/
StockFlow
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Program.cs
43 строки
1 KB
StockFlow Student
Initial StockFlow project
19 май 2026, 22:54
19 май 2026, 22:54
99ece9c
Код
Авторство
О чём код?
using Microsoft.EntityFrameworkCore; using StockFlow.Data; using StockFlow.Models; var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext<AppDbContext>(options => options.UseSqlite("Data Source=stockflow.db")); builder.Services.Configure<InventorySettings>( builder.Configuration.GetSection(InventorySettings.SectionName)); // Add services to the container. builder.Services.AddControllersWithViews(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.MapStaticAssets(); app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}") .WithStaticAssets(); using (var scope = app.Services.CreateScope()) { var context = scope.ServiceProvider.GetRequiredService<AppDbContext>(); await context.Database.MigrateAsync(); await DbInitializer.SeedAsync(context); } app.Run();