-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
executable file
·48 lines (40 loc) · 1.73 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Blazored.LocalStorage;
using Microsoft.EntityFrameworkCore;
using MudBlazor;
using MudBlazor.Services;
using TaskSystem.Components;
using TaskSystem.Data;
using TaskSystem.Services;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("tasks.db");
// Add services to the container.
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddMudServices(config =>
{
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
config.SnackbarConfiguration.PreventDuplicates = false;
config.SnackbarConfiguration.NewestOnTop = false;
config.SnackbarConfiguration.ShowCloseIcon = true;
config.SnackbarConfiguration.VisibleStateDuration = 1500;
config.SnackbarConfiguration.HideTransitionDuration = 1000;
config.SnackbarConfiguration.ShowTransitionDuration = 250;
config.SnackbarConfiguration.SnackbarVariant = Variant.Outlined;
});
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddSingleton<UpdateTitleService>();
builder.Services.AddScoped<ITaskService, TaskService>();
builder.Services.AddDbContextFactory<DatabaseContext>(options => options.UseSqlite(connectionString));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// 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.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();