2024-05-09 01:24:50 +08:00
|
|
|
using BITKit;
|
2024-05-10 02:59:40 +08:00
|
|
|
using IDIS_Server_SIM.Data;
|
2024-05-09 01:24:50 +08:00
|
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using IDIS.Client.Web.Components;
|
2024-05-31 01:19:55 +08:00
|
|
|
using IDIS.Client.Web.Data;
|
2024-05-09 01:24:50 +08:00
|
|
|
using IDIS.Models;
|
|
|
|
using IDIS.Services;
|
|
|
|
using MudBlazor.Services;
|
|
|
|
|
|
|
|
await BITAppForNet.InitializeAsync("IDIS");
|
|
|
|
|
|
|
|
var config = Path.Combine(Environment.CurrentDirectory,"appsettings.json");
|
|
|
|
if (File.Exists(config))
|
|
|
|
{
|
|
|
|
var json = File.ReadAllText(config);
|
|
|
|
DataParser.Set(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddRazorComponents()
|
|
|
|
.AddInteractiveServerComponents();
|
|
|
|
|
|
|
|
builder.Services.AddMudServices();
|
|
|
|
|
|
|
|
builder.Services.AddCascadingAuthenticationState();
|
|
|
|
|
2024-05-31 01:19:55 +08:00
|
|
|
builder.Services.AddTransient<OneClickRegister>();
|
2024-05-10 02:59:40 +08:00
|
|
|
builder.Services.AddTransient<QueryService>();
|
|
|
|
builder.Services.AddTransient<IDIS_Statistics_MySQLBased>();
|
|
|
|
builder.Services.AddTransient<IDIS_Service_MySQLBased>();
|
|
|
|
builder.Services.AddTransient<IDIS_EnterpriseService, IDIS_EnterpriseService_MySQLBased>();
|
2024-05-09 01:24:50 +08:00
|
|
|
builder.Services.AddTransient<IDIS_Service, IDIS_Service_MySQLBased>();
|
|
|
|
builder.Services.AddTransient<IDIS_TemplateService, IDIS_TemplateService_MySQLBased>();
|
|
|
|
|
|
|
|
builder.Services.AddAuthentication(options =>
|
|
|
|
{
|
|
|
|
options.DefaultScheme = IdentityConstants.ApplicationScheme;
|
|
|
|
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
|
|
|
|
})
|
|
|
|
.AddIdentityCookies();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
2024-05-10 02:59:40 +08:00
|
|
|
app.Services.GetRequiredService<IDIS_Statistics_MySQLBased>();
|
|
|
|
|
2024-05-09 01:24:50 +08:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
// Add additional endpoints required by the Identity /Account Razor components.
|
|
|
|
|
|
|
|
app.Run();
|