Add initial hcs database schema creation

This commit is contained in:
2025-10-22 16:42:00 +09:00
parent 77626a8e52
commit 37cf856685
38 changed files with 302 additions and 336 deletions

View File

@ -1,6 +1,7 @@
using Hcs.WebApp.Components;
using Hcs.WebApp.Components.Shared;
using Hcs.WebApp.Data;
using Hcs.WebApp.Data.Hcs;
using Hcs.WebApp.Data.Identity;
using Hcs.WebApp.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity;
@ -22,8 +23,8 @@ builder.Services.AddHeaderPropagation(x => x.Headers.Add("Cookie"));
builder.Services.AddAuthentication();
builder.Services.AddAuthorization();
var connectionString = builder.Configuration.GetConnectionString("IdentityConnection") ?? throw new InvalidOperationException("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 'IdentityConnection'");
builder.Services.AddDbContextFactory<AppIdentityDbContext>(options => options.UseSqlServer(connectionString));
var identityConnection = builder.Configuration.GetConnectionString("IdentityConnection") ?? throw new InvalidOperationException("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 'IdentityConnection'");
builder.Services.AddDbContextFactory<AppIdentityDbContext>(options => options.UseSqlServer(identityConnection));
builder.Services
.AddIdentity<AppUser, AppRole>(options =>
@ -38,6 +39,17 @@ builder.Services
.AddEntityFrameworkStores<AppIdentityDbContext>()
.AddDefaultTokenProviders();
if (builder.Environment.IsDevelopment())
{
var hcsProdConnection = builder.Configuration.GetConnectionString("HcsSit2Connection") ?? throw new InvalidOperationException("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 'HcsSit2Connection'");
builder.Services.AddDbContextFactory<HcsDbContext>(options => options.UseSqlServer(hcsProdConnection));
}
else
{
var hcsProdConnection = builder.Configuration.GetConnectionString("HcsProdConnection") ?? throw new InvalidOperationException("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 'HcsProdConnection'");
builder.Services.AddDbContextFactory<HcsDbContext>(options => options.UseSqlServer(hcsProdConnection));
}
#if USE_MOCK
builder.Services.AddTransient<IClientProvider, MockClientProvider>();
#else