Completo riorganizzazione progetti:
- Core - Data.Admin
This commit is contained in:
+29
-24
@@ -1,22 +1,23 @@
|
||||
using MagMan.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MagMan.Data;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using StackExchange.Redis;
|
||||
using MagMan.Data.Services;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using System.Configuration;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using HealthChecks.UI.Client;
|
||||
using MagMan.Core;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data;
|
||||
using MagMan.Data.Admin;
|
||||
using MagMan.Data.Tenant;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using MagMan.UI.Areas.Identity;
|
||||
using MagMan.UI.Data;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using StackExchange.Redis;
|
||||
using System.Globalization;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -37,14 +38,18 @@ builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
string dbServerAddr = builder.Configuration["DbConfig:Server"];
|
||||
string nKey = builder.Configuration["DbConfig:nKey"];
|
||||
string sKey = builder.Configuration["DbConfig:sKey"];
|
||||
MagMan.Data.DbConfig.InitDb(dbServerAddr, nKey, sKey);
|
||||
MagMan.User.DbConfig.InitDb(dbServerAddr, nKey, sKey);
|
||||
MagMan.Data.Admin.DbConfig.InitDb(dbServerAddr, nKey, sKey);
|
||||
MagMan.Data.Tenant.DbConfig.InitDb(dbServerAddr, nKey, sKey);
|
||||
// inizializzo il DB e creo (se necessario) l'utente
|
||||
MagMan.User.DbConfig.CheckUser(nKey, sKey);
|
||||
MagMan.Data.Admin.DbConfig.CheckUser(nKey, sKey);
|
||||
|
||||
// spostare e fare in caso nelle chiamate custom
|
||||
#if true
|
||||
// verifico se serve applicazione migrazioni
|
||||
MagMan.Data.DbConfig.ExecMigrationMain();
|
||||
MagMan.Data.Tenant.DbConfig.ExecMigrationMain();
|
||||
#endif
|
||||
//DbConfig.ExecMigrationIdentity();
|
||||
string connStringDB = DbConfig.CONNECTION_STRING;
|
||||
string connStringDB = MagMan.Data.Admin.DbConfig.CONNECTION_STRING;
|
||||
|
||||
// healthchecks
|
||||
builder.Services.AddHealthChecks()
|
||||
@@ -85,11 +90,11 @@ builder.Services.Configure<DataProtectionTokenProviderOptions>(o =>
|
||||
|
||||
|
||||
|
||||
builder.Services.AddDbContext<MagMan.User.UserIdentityDbContext>(options =>
|
||||
builder.Services.AddDbContext<MagMan.Data.Admin.UserIdentityDbContext>(options =>
|
||||
options.UseSqlServer(connectionString));
|
||||
|
||||
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<MagMan.User.UserIdentityDbContext>();
|
||||
.AddEntityFrameworkStores<MagMan.Data.Admin.UserIdentityDbContext>();
|
||||
|
||||
#if false
|
||||
|
||||
@@ -123,7 +128,7 @@ builder.Services.AddBlazoredLocalStorage();
|
||||
builder.Services.AddBlazoredSessionStorage();
|
||||
|
||||
// gestione email
|
||||
builder.Services.Configure<MailKitMailSettings>(builder.Configuration.GetSection(nameof(MailKitMailSettings)));
|
||||
builder.Services.Configure<MagMan.Core.MailKitMailSettings>(builder.Configuration.GetSection(nameof(MailKitMailSettings)));
|
||||
builder.Services.AddScoped<MailService>();
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
Reference in New Issue
Block a user