-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
50 lines (38 loc) · 1.46 KB
/
Program.cs
File metadata and controls
50 lines (38 loc) · 1.46 KB
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
49
50
using Microsoft.EntityFrameworkCore;
using Storge.Components;
using Storge.Data;
using Storge.Data.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddResponseCompression(o => o.EnableForHttps = true);
builder.Services.AddOutputCache(options =>
{
options.AddBasePolicy(p => p.Expire(TimeSpan.FromMinutes(2)));
});
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddPooledDbContextFactory<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
builder.Services.AddScoped<ActivityService>();
builder.Services.AddScoped<GalleryService>();
builder.Services.AddScoped<ProjectService>();
builder.Services.AddScoped<EventService>();
builder.Services.AddScoped<TeamMemberService>();
builder.Services.AddScoped<EmailService>();
var app = builder.Build();
app.UseResponseCompression();
app.UseOutputCache();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/chyba", createScopeForErrors: true);
app.UseHsts();
}
app.UseStatusCodePagesWithReExecute("/stranka-nenalezena", createScopeForStatusCodePages: true);
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();