82 lines
3.0 KiB
C#
82 lines
3.0 KiB
C#
namespace LaaProductionWeb.Blazor
|
|
{
|
|
using LaaPackages.Data.HeliumTester;
|
|
using LaaProductionWeb.Blazor.Components;
|
|
using LaaProductionWeb.Blazor.Components.CSD.Data;
|
|
using LaaProductionWeb.Blazor.Components.HeliumTester.Models;
|
|
using LaaProductionWeb.Blazor.Components.Identity.Services;
|
|
using LaaProductionWeb.Blazor.Components.Logging.Sqlite;
|
|
using LaaProductionWeb.Blazor.Infrastructure;
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
var configuration = builder.Configuration;
|
|
|
|
var logging = builder.Logging;
|
|
logging.AddConfiguration(configuration);
|
|
logging.ClearProviders();
|
|
logging.AddSqliteLogging();
|
|
|
|
var services = builder.Services;
|
|
|
|
services.Configure<ConnectionStrings>(configuration.GetSection(nameof(ConnectionStrings)));
|
|
services.Configure<SqliteLoggerOptions>(configuration.GetSection(nameof(SqliteLoggerOptions)));
|
|
|
|
services.AddDbContext<HeliumTesterDbContext>(options =>
|
|
{
|
|
var connectionString = configuration
|
|
.GetSection(nameof(ConnectionStrings))
|
|
.GetValue<string>(nameof(ConnectionStrings.Auftrag));
|
|
options.UseSqlServer(connectionString);
|
|
options.EnableDetailedErrors();
|
|
options.EnableSensitiveDataLogging();
|
|
});
|
|
|
|
services.AddScoped<IdentityService>();
|
|
services.AddScoped<IdentityJwtService>();
|
|
services.AddScoped<HeliumTesterService>();
|
|
services.AddScoped<MatchCollectionModel>();
|
|
services.AddScoped<CSDDBContext>();
|
|
|
|
services.AddSingleton<SqliteLoggingDbContext>();
|
|
|
|
services.AddTransient<RecipesCollectionModel>();
|
|
|
|
services.AddRazorComponents(options => options.DetailedErrors = true)
|
|
.AddInteractiveServerComponents(options => options.DetailedErrors = true);
|
|
services.AddAuthenticationCore();
|
|
services.AddAuthorizationCore();
|
|
services.AddCascadingAuthenticationState();
|
|
services.AddScoped<AuthenticationStateProvider, IdentityStateProvider>();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseAntiforgery();
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
app.MapStaticAssets();
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
}
|