feat: 租户管理模块,审计模块。 运行测试OK

main
NoahLan 10 months ago
parent b0a37baf94
commit 4efb3aafa6

@ -48,11 +48,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "audit-logging", "audit-logg
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "upms", "upms", "{CA0606BE-4146-4390-86CD-AD92FC161A9E}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "upms", "upms", "{CA0606BE-4146-4390-86CD-AD92FC161A9E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.Domain.Shared", "module\NPin.Framework.AuditLogging.Domain.Shared\NPin.Framework.AuditLogging.Domain.Shared.csproj", "{67D8E078-69EC-4D2C-8B12-BDB66FB45B58}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tenant-management", "tenant-management", "{FFB03EF5-B008-4F84-83D8-2F4B5D821251}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.Domain", "module\NPin.Framework.AuditLogging.Domain\NPin.Framework.AuditLogging.Domain.csproj", "{CF3EECF5-EE94-47F4-978B-2F648B02F99F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.Domain", "module\audit-logging\NPin.Framework.AuditLogging.Domain\NPin.Framework.AuditLogging.Domain.csproj", "{734EF33E-028A-44C3-B83F-13DBFA8AC117}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.SqlSugarCore", "module\NPin.Framework.AuditLogging.SqlSugarCore\NPin.Framework.AuditLogging.SqlSugarCore.csproj", "{E50D68D7-8A0C-451D-9344-EE022054E31E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.Domain.Shared", "module\audit-logging\NPin.Framework.AuditLogging.Domain.Shared\NPin.Framework.AuditLogging.Domain.Shared.csproj", "{70685213-B0C0-4589-B9ED-A67838227705}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.AuditLogging.SqlSugarCore", "module\audit-logging\NPin.Framework.AuditLogging.SqlSugarCore\NPin.Framework.AuditLogging.SqlSugarCore.csproj", "{6253E408-8F24-4FCA-8EDA-F7FCAFFC916C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.TenantManagement.Application", "module\tenant-management\NPin.Framework.TenantManagement.Application\NPin.Framework.TenantManagement.Application.csproj", "{BC0B626C-BF67-4279-8EAB-66CF0DA912AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.TenantManagement.Application.Contracts", "module\tenant-management\NPin.Framework.TenantManagement.Application.Contracts\NPin.Framework.TenantManagement.Application.Contracts.csproj", "{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.TenantManagement.Domain", "module\tenant-management\NPin.Framework.TenantManagement.Domain\NPin.Framework.TenantManagement.Domain.csproj", "{6F3DF341-F4BB-416A-8772-F68B4626C0C8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPin.Framework.TenantManagement.SqlSugarCore", "module\tenant-management\NPin.Framework.TenantManagement.SqlSugarCore\NPin.Framework.TenantManagement.SqlSugarCore.csproj", "{9B6CAF84-D53C-4595-93B7-231E771FAED3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -120,18 +130,34 @@ Global
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Debug|Any CPU.Build.0 = Debug|Any CPU {DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.ActiveCfg = Release|Any CPU {DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.Build.0 = Release|Any CPU {DC8E2E59-589F-4521-95E2-9CE7E1DD5541}.Release|Any CPU.Build.0 = Release|Any CPU
{67D8E078-69EC-4D2C-8B12-BDB66FB45B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {734EF33E-028A-44C3-B83F-13DBFA8AC117}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67D8E078-69EC-4D2C-8B12-BDB66FB45B58}.Debug|Any CPU.Build.0 = Debug|Any CPU {734EF33E-028A-44C3-B83F-13DBFA8AC117}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67D8E078-69EC-4D2C-8B12-BDB66FB45B58}.Release|Any CPU.ActiveCfg = Release|Any CPU {734EF33E-028A-44C3-B83F-13DBFA8AC117}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67D8E078-69EC-4D2C-8B12-BDB66FB45B58}.Release|Any CPU.Build.0 = Release|Any CPU {734EF33E-028A-44C3-B83F-13DBFA8AC117}.Release|Any CPU.Build.0 = Release|Any CPU
{CF3EECF5-EE94-47F4-978B-2F648B02F99F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {70685213-B0C0-4589-B9ED-A67838227705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF3EECF5-EE94-47F4-978B-2F648B02F99F}.Debug|Any CPU.Build.0 = Debug|Any CPU {70685213-B0C0-4589-B9ED-A67838227705}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF3EECF5-EE94-47F4-978B-2F648B02F99F}.Release|Any CPU.ActiveCfg = Release|Any CPU {70685213-B0C0-4589-B9ED-A67838227705}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF3EECF5-EE94-47F4-978B-2F648B02F99F}.Release|Any CPU.Build.0 = Release|Any CPU {70685213-B0C0-4589-B9ED-A67838227705}.Release|Any CPU.Build.0 = Release|Any CPU
{E50D68D7-8A0C-451D-9344-EE022054E31E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6253E408-8F24-4FCA-8EDA-F7FCAFFC916C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E50D68D7-8A0C-451D-9344-EE022054E31E}.Debug|Any CPU.Build.0 = Debug|Any CPU {6253E408-8F24-4FCA-8EDA-F7FCAFFC916C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E50D68D7-8A0C-451D-9344-EE022054E31E}.Release|Any CPU.ActiveCfg = Release|Any CPU {6253E408-8F24-4FCA-8EDA-F7FCAFFC916C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E50D68D7-8A0C-451D-9344-EE022054E31E}.Release|Any CPU.Build.0 = Release|Any CPU {6253E408-8F24-4FCA-8EDA-F7FCAFFC916C}.Release|Any CPU.Build.0 = Release|Any CPU
{BC0B626C-BF67-4279-8EAB-66CF0DA912AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC0B626C-BF67-4279-8EAB-66CF0DA912AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC0B626C-BF67-4279-8EAB-66CF0DA912AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC0B626C-BF67-4279-8EAB-66CF0DA912AE}.Release|Any CPU.Build.0 = Release|Any CPU
{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF}.Release|Any CPU.Build.0 = Release|Any CPU
{6F3DF341-F4BB-416A-8772-F68B4626C0C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F3DF341-F4BB-416A-8772-F68B4626C0C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F3DF341-F4BB-416A-8772-F68B4626C0C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F3DF341-F4BB-416A-8772-F68B4626C0C8}.Release|Any CPU.Build.0 = Release|Any CPU
{9B6CAF84-D53C-4595-93B7-231E771FAED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B6CAF84-D53C-4595-93B7-231E771FAED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B6CAF84-D53C-4595-93B7-231E771FAED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B6CAF84-D53C-4595-93B7-231E771FAED3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{088B4948-AE5B-45B3-A9FA-B853671CFA05} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C} {088B4948-AE5B-45B3-A9FA-B853671CFA05} = {F2A0A89E-A2F9-48CF-AD38-0318B5ACD11C}
@ -151,8 +177,13 @@ Global
{DC8E2E59-589F-4521-95E2-9CE7E1DD5541} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D} {DC8E2E59-589F-4521-95E2-9CE7E1DD5541} = {86F61EBB-4ACC-459C-AB3C-C8D486C3017D}
{29EA07EB-E1D2-4BCA-9EA4-D69E28F14978} = {EEAD0AD4-0F90-46D9-A775-D88AE07E2869} {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978} = {EEAD0AD4-0F90-46D9-A775-D88AE07E2869}
{CA0606BE-4146-4390-86CD-AD92FC161A9E} = {EEAD0AD4-0F90-46D9-A775-D88AE07E2869} {CA0606BE-4146-4390-86CD-AD92FC161A9E} = {EEAD0AD4-0F90-46D9-A775-D88AE07E2869}
{67D8E078-69EC-4D2C-8B12-BDB66FB45B58} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978} {FFB03EF5-B008-4F84-83D8-2F4B5D821251} = {EEAD0AD4-0F90-46D9-A775-D88AE07E2869}
{CF3EECF5-EE94-47F4-978B-2F648B02F99F} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978} {734EF33E-028A-44C3-B83F-13DBFA8AC117} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978}
{E50D68D7-8A0C-451D-9344-EE022054E31E} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978} {70685213-B0C0-4589-B9ED-A67838227705} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978}
{6253E408-8F24-4FCA-8EDA-F7FCAFFC916C} = {29EA07EB-E1D2-4BCA-9EA4-D69E28F14978}
{BC0B626C-BF67-4279-8EAB-66CF0DA912AE} = {FFB03EF5-B008-4F84-83D8-2F4B5D821251}
{FAB3D7AE-2260-4DC1-B2BB-E26C540056BF} = {FFB03EF5-B008-4F84-83D8-2F4B5D821251}
{6F3DF341-F4BB-416A-8772-F68B4626C0C8} = {FFB03EF5-B008-4F84-83D8-2F4B5D821251}
{9B6CAF84-D53C-4595-93B7-231E771FAED3} = {FFB03EF5-B008-4F84-83D8-2F4B5D821251}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

@ -12,7 +12,7 @@ namespace NPin.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection;
public static class SwaggerAddExtensions public static class SwaggerAddExtensions
{ {
public static IServiceCollection AddNPinSwaggerGen<Program>(this IServiceCollection services, public static IServiceCollection AddNPinSwaggerGen<TProgram>(this IServiceCollection services,
Action<SwaggerGenOptions>? action = null) Action<SwaggerGenOptions>? action = null)
{ {
var serviceProvider = services.BuildServiceProvider(); var serviceProvider = services.BuildServiceProvider();
@ -52,8 +52,10 @@ public static class SwaggerAddExtensions
return false; return false;
}); });
options.CustomSchemaIds(type => type.FullName); // options.CustomSchemaIds(type => type.Name);
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); options.CustomSchemaIds(type => $"{type.Namespace}.{type.Name}");
var basePath = Path.GetDirectoryName(typeof(TProgram).Assembly.Location);
if (basePath is not null) if (basePath is not null)
{ {
foreach (var item in Directory.GetFiles(basePath, "*.xml")) foreach (var item in Directory.GetFiles(basePath, "*.xml"))
@ -62,7 +64,7 @@ public static class SwaggerAddExtensions
} }
} }
options.AddSecurityDefinition("JWT", new OpenApiSecurityScheme options.AddSecurityDefinition("JwtBearer", new OpenApiSecurityScheme
{ {
Description = "输入JWT-Token", Description = "输入JWT-Token",
Name = "Authorization", Name = "Authorization",

@ -4,7 +4,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FreeRedis" Version="1.2.13" /> <PackageReference Include="FreeRedis" Version="1.2.13" />
<PackageReference Include="FreeRedis.DistributedCache" Version="1.2.5" /> <PackageReference Include="FreeRedis.DistributedCache" Version="1.2.5" />
<PackageReference Include="Volo.Abp.Caching" Version="8.0.3" /> <PackageReference Include="Volo.Abp.Caching" Version="8.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -4,6 +4,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0"/> <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="Volo.Abp.Core" Version="8.0.2"/> <PackageReference Include="Volo.Abp.Core" Version="8.0.0"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="8.1.0-rc.1" /> <PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NPin.Framework.Core\NPin.Framework.Core.csproj" /> <ProjectReference Include="..\NPin.Framework.Core\NPin.Framework.Core.csproj" />

@ -9,7 +9,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="MiniExcel" Version="1.31.3" /> <PackageReference Include="MiniExcel" Version="1.31.3" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="8.0.4" /> <PackageReference Include="Volo.Abp.Ddd.Application" Version="8.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" /> <PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Volo.Abp.ObjectMapping" Version="8.0.2" /> <PackageReference Include="Volo.Abp.ObjectMapping" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -1,11 +1,13 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using NPin.Framework.Core; using NPin.Framework.Core;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
namespace NPin.Framework.Mapster; namespace NPin.Framework.Mapster;
[DependsOn(typeof(NPinFrameworkCoreModule), typeof(AbpObjectMappingModule))] [DependsOn(
typeof(NPinFrameworkCoreModule),
typeof(AbpObjectMappingModule)
)]
public class NPinFrameworkMapsterModule : AbpModule public class NPinFrameworkMapsterModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

@ -61,12 +61,12 @@ public class DbConnOptions
/// </summary> /// </summary>
public List<SaasMultiTenancyOptions>? SaasMultiTenancy { get; set; } public List<SaasMultiTenancyOptions>? SaasMultiTenancy { get; set; }
public static string MasterTenantDbDefaultName = "Master"; public static string MasterTenantName = "Master";
public static string TenantDbDefaultName = "Default"; public static string DefaultTenantName = "Default";
public SaasMultiTenancyOptions GetDefaultSaasMultiTenancy() public SaasMultiTenancyOptions GetDefaultSaasMultiTenancy()
{ {
return new SaasMultiTenancyOptions { Name = TenantDbDefaultName, Url = Url }; return new SaasMultiTenancyOptions { Name = DefaultTenantName, Url = Url };
} }
public SaasMultiTenancyOptions? GetDefaultMasterSaasMultiTenancy() public SaasMultiTenancyOptions? GetDefaultMasterSaasMultiTenancy()
@ -78,13 +78,13 @@ public class DbConnOptions
if (string.IsNullOrEmpty(MasterSaasMultiTenancyUrl)) if (string.IsNullOrEmpty(MasterSaasMultiTenancyUrl))
{ {
return new SaasMultiTenancyOptions { Name = MasterTenantDbDefaultName, Url = Url }; return new SaasMultiTenancyOptions { Name = MasterTenantName, Url = Url };
} }
else else
{ {
return new SaasMultiTenancyOptions() return new SaasMultiTenancyOptions()
{ {
Name = MasterTenantDbDefaultName, Name = MasterTenantName,
Url = MasterSaasMultiTenancyUrl Url = MasterSaasMultiTenancyUrl
}; };
} }

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.140" /> <PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.140" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.2" /> <PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -15,7 +15,7 @@ public class UnitOfWorkSqlSugarDbContextProvider<TDbContext> : ISugarDbContextPr
where TDbContext : ISqlSugarDbContext where TDbContext : ISqlSugarDbContext
{ {
private readonly ISqlSugarDbConnectionCreator _dbConnectionCreator; private readonly ISqlSugarDbConnectionCreator _dbConnectionCreator;
private readonly string MasterTenantDbDefaultName = DbConnOptions.MasterTenantDbDefaultName; private readonly string MasterTenantDbDefaultName = DbConnOptions.MasterTenantName;
private ILogger<UnitOfWorkSqlSugarDbContextProvider<TDbContext>> Logger { get; set; } private ILogger<UnitOfWorkSqlSugarDbContextProvider<TDbContext>> Logger { get; set; }
private IServiceProvider ServiceProvider { get; set; } private IServiceProvider ServiceProvider { get; set; }
@ -99,7 +99,7 @@ public class UnitOfWorkSqlSugarDbContextProvider<TDbContext> : ISugarDbContextPr
if (string.IsNullOrWhiteSpace(connectionString)) if (string.IsNullOrWhiteSpace(connectionString))
{ {
connectionString = dbContext.Options.Url; connectionString = dbContext.Options.Url;
configId = DbConnOptions.TenantDbDefaultName; configId = DbConnOptions.DefaultTenantName;
} }
var dbOption = dbContext.Options; var dbOption = dbContext.Options;

@ -1,5 +0,0 @@
namespace module;
public class Class1
{
}

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="8.0.4" /> <PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="8.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -7,12 +7,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Auditing" Version="8.0.4" /> <PackageReference Include="Volo.Abp.Auditing" Version="8.0.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.4" /> <PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" /> <ProjectReference Include="..\..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" />
<ProjectReference Include="..\NPin.Framework.AuditLogging.Domain.Shared\NPin.Framework.AuditLogging.Domain.Shared.csproj" /> <ProjectReference Include="..\NPin.Framework.AuditLogging.Domain.Shared\NPin.Framework.AuditLogging.Domain.Shared.csproj" />
</ItemGroup> </ItemGroup>

@ -7,8 +7,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" /> <ProjectReference Include="..\..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" /> <ProjectReference Include="..\..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" />
<ProjectReference Include="..\NPin.Framework.AuditLogging.Domain\NPin.Framework.AuditLogging.Domain.csproj" /> <ProjectReference Include="..\NPin.Framework.AuditLogging.Domain\NPin.Framework.AuditLogging.Domain.csproj" />
</ItemGroup> </ItemGroup>

@ -127,7 +127,7 @@ public class AuditLogRepository : SqlSugarRepository<AuditLogAggregateRoot, Guid
bool includeDetails = false) bool includeDetails = false)
{ {
var nHttpStatusCode = (int?)httpStatusCode; var nHttpStatusCode = (int?)httpStatusCode;
return DbQueryable var queryable = DbQueryable
.WhereIF(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime) .WhereIF(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime)
.WhereIF(endTime.HasValue, auditLog => auditLog.ExecutionTime <= endTime) .WhereIF(endTime.HasValue, auditLog => auditLog.ExecutionTime <= endTime)
.WhereIF(hasException.HasValue && hasException.Value, .WhereIF(hasException.HasValue && hasException.Value,
@ -148,6 +148,8 @@ public class AuditLogRepository : SqlSugarRepository<AuditLogAggregateRoot, Guid
auditLog => auditLog.ExecutionDuration <= maxExecutionDuration) auditLog => auditLog.ExecutionDuration <= maxExecutionDuration)
.WhereIF(minExecutionDuration != null && minExecutionDuration.Value > 0, .WhereIF(minExecutionDuration != null && minExecutionDuration.Value > 0,
auditLog => auditLog.ExecutionDuration >= minExecutionDuration); auditLog => auditLog.ExecutionDuration >= minExecutionDuration);
return queryable;
} }
public async Task<EntityChangeEntity> GetEntityChange(Guid entityChangeId, public async Task<EntityChangeEntity> GetEntityChange(Guid entityChangeId,
@ -207,7 +209,7 @@ public class AuditLogRepository : SqlSugarRepository<AuditLogAggregateRoot, Guid
.WhereIF(changeType.HasValue, e => e.ChangeType == changeType) .WhereIF(changeType.HasValue, e => e.ChangeType == changeType)
.WhereIF(!string.IsNullOrWhiteSpace(entityId), e => e.EntityId == entityId) .WhereIF(!string.IsNullOrWhiteSpace(entityId), e => e.EntityId == entityId)
.WhereIF(!string.IsNullOrWhiteSpace(entityTypeFullName), .WhereIF(!string.IsNullOrWhiteSpace(entityTypeFullName),
e => e.EntityTypeFullName.Contains(entityTypeFullName)); e => e.EntityTypeFullName!.Contains(entityTypeFullName));
} }
public async Task<List<EntityChangeWithUsername>> GetEntityChangesWithUsernameAsync(string entityId, public async Task<List<EntityChangeWithUsername>> GetEntityChangesWithUsernameAsync(string entityId,

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,11 @@
using SqlSugar;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantCreateInput
{
public string Name { get; set; }
public string TenantConnectionString { get; set; }
public DbType DbType { get; set; }
}

@ -0,0 +1,12 @@
using NPin.Framework.Ddd.Application.Contracts;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantGetListInput : PagedAllResultRequestDto
{
public string? Name { get; set; }
//public int? EntityVersion { get; set; }
//public string? TenantConnectionString { get; set; }
//public DbType? DbType { get; set; }
}

@ -0,0 +1,13 @@
using SqlSugar;
using Volo.Abp.Application.Dtos;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantGetListOutputDto: EntityDto<Guid>
{
public string Name { get; set; }
public int EntityVersion { get; set; }
public string TenantConnectionString { get; set; }
public DbType DbType { get; set; }
public DateTime CreationTime { get; set; }
}

@ -0,0 +1,13 @@
using SqlSugar;
using Volo.Abp.Application.Dtos;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantGetOutputDto: EntityDto<Guid>
{
public string Name { get; set; }
public int EntityVersion { get; set; }
public string TenantConnectionString { get; set; }
public DbType DbType { get; set; }
public DateTime CreationTime { get; set; }
}

@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantSelectOutputDto: EntityDto<Guid>
{
public string Name { get; set; }
}

@ -0,0 +1,11 @@
using SqlSugar;
namespace NPin.Framework.TenantManagement.Application.Contracts.Dtos;
public class TenantUpdateInput
{
public string? Name { get; set; }
public int? EntityVersion { get; set; }
public string? TenantConnectionString { get; set; }
public DbType? DbType { get; set; }
}

@ -0,0 +1,12 @@
using NPin.Framework.Ddd.Application.Contracts;
using NPin.Framework.TenantManagement.Application.Contracts.Dtos;
namespace NPin.Framework.TenantManagement.Application.Contracts;
/// <summary>
/// 租户CRUD服务
/// </summary>
public interface ITenantService : INPinCrudAppService<TenantGetOutputDto, TenantGetListOutputDto, Guid,
TenantGetListInput, TenantCreateInput, TenantUpdateInput>
{
}

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\NPin.Framework.Ddd.Application.Contracts\NPin.Framework.Ddd.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,13 @@
using NPin.Framework.Ddd.Application.Contracts;
using Volo.Abp.Modularity;
using Volo.Abp.TenantManagement;
namespace NPin.Framework.TenantManagement.Application.Contracts;
[DependsOn(
typeof(AbpTenantManagementDomainSharedModule),
typeof(NPinFrameworkDddApplicationContractsModule)
)]
public class NPinFrameworkTenantManagementApplicationContractsModule : AbpModule
{
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\NPin.Framework.Ddd.Application\NPin.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\NPin.Framework.TenantManagement.Application.Contracts\NPin.Framework.TenantManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\NPin.Framework.TenantManagement.Domain\NPin.Framework.TenantManagement.Domain.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,9 @@
using NPin.Framework.TenantManagement.Domain;
using Volo.Abp.Modularity;
namespace NPin.Framework.TenantManagement.Application;
[DependsOn(typeof(NPinFrameworkTenantManagementDomainModule))]
public class NPinFrameworkTenantManagementApplicationModule : AbpModule
{
}

@ -0,0 +1,143 @@
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using NPin.Framework.Ddd.Application;
using NPin.Framework.SqlSugarCore.Abstractions;
using NPin.Framework.TenantManagement.Application.Contracts;
using NPin.Framework.TenantManagement.Application.Contracts.Dtos;
using NPin.Framework.TenantManagement.Domain;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Modularity;
namespace NPin.Framework.TenantManagement.Application;
public class TenantService : NPinCrudAppService<TenantAggregateRoot, TenantGetOutputDto, TenantGetListOutputDto, Guid,
TenantGetListInput, TenantCreateInput, TenantUpdateInput>, ITenantService
{
private ISqlSugarRepository<TenantAggregateRoot, Guid> _repository;
private IDataSeeder _dataSeeder;
public TenantService(IRepository<TenantAggregateRoot, Guid> repository,
ISqlSugarRepository<TenantAggregateRoot, Guid> repository2, IDataSeeder dataSeeder) : base(repository)
{
_repository = repository2;
_dataSeeder = dataSeeder;
}
/// <summary>
/// 多查
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<PagedResultDto<TenantGetListOutputDto>> GetListAsync(TenantGetListInput input)
{
RefAsync<int> total = 0;
var entities = await _repository.DbQueryable
.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!))
.WhereIF(input.StartTime is not null && input.EndTime is not null,
x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
return new PagedResultDto<TenantGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
/// <summary>
/// 租户选项列表(显示名称)
/// </summary>
/// <returns></returns>
public async Task<List<TenantSelectOutputDto>> GetSelectAsync()
{
var entities = await _repository.DbQueryable.ToListAsync();
return entities.Select(x => new TenantSelectOutputDto { Id = x.Id, Name = x.Name })
.ToList();
}
/// <summary>
/// 创建租户
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<TenantGetOutputDto> CreateAsync(TenantCreateInput input)
{
// 检查是否存在
if (await _repository.IsAnyAsync(x => x.Name == input.Name))
{
throw new UserFriendlyException("创建失败,当前租户已存在");
}
return await base.CreateAsync(input);
}
/// <summary>
/// 更新租户信息
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<TenantGetOutputDto> UpdateAsync(Guid id, TenantUpdateInput input)
{
if (await _repository.IsAnyAsync(x => x.Name == input.Name && x.Id != id))
{
throw new UserFriendlyException("更新失败,更新后租户已存在");
}
return await base.UpdateAsync(id, input);
}
// 只是为了可以在swagger上展示?
/// <summary>
/// 租户删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public override Task DeleteAsync(IEnumerable<Guid> ids)
{
return base.DeleteAsync(ids);
}
/// <summary>
/// 初始化租户
/// </summary>
/// <param name="id"></param>
[HttpPost("tenant/init/{id}")]
public async Task InitAsync([FromRoute] Guid id)
{
using (CurrentTenant.Change(id))
{
// 初始化 租户数据库/表 结构
await CodeFirst(LazyServiceProvider);
// 插入 种子数据
await _dataSeeder.SeedAsync(id);
}
}
/// <summary>
/// 数据库 / 表 初始化
/// </summary>
/// <param name="service"></param>
private async Task CodeFirst(IServiceProvider service)
{
var moduleContainer = service.GetRequiredService<IModuleContainer>();
var db = await _repository.GetDbContextAsync();
// 尝试创建数据库
db.DbMaintenance.CreateDatabase();
List<Type> types = new List<Type>();
foreach (var module in moduleContainer.Modules)
{
types.AddRange(module.Assembly.GetTypes()
.Where(x => x.GetCustomAttribute<IgnoreCodeFirstAttribute>() == null)
.Where(x => x.GetCustomAttribute<SugarTable>() != null)
.Where(x => x.GetCustomAttribute<SplitTableAttribute>() is null));
}
if (types.Count > 0)
{
db.CopyNew().CodeFirst.InitTables(types.ToArray());
}
}
}

@ -0,0 +1,13 @@
using NPin.Framework.SqlSugarCore.Abstractions;
namespace NPin.Framework.TenantManagement.Domain;
public interface ISqlSugarTenantRepository : ISqlSugarRepository<TenantAggregateRoot, Guid>
{
Task<TenantAggregateRoot> FindByNameAsync(string name, bool includeDetails = true);
Task<List<TenantAggregateRoot>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue,
int skipCount = 0, string filter = null, bool includeDetails = false);
Task<long> GetCountAsync(string filter = null);
}

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="8.0.0" />
</ItemGroup>
</Project>

@ -0,0 +1,26 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.Data;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.TenantManagement;
namespace NPin.Framework.TenantManagement.Domain;
[DependsOn(
typeof(AbpDddDomainModule),
typeof(AbpTenantManagementDomainSharedModule)
)]
public class NPinFrameworkTenantManagementDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var services = context.Services;
// 替换原有服务
services.Replace(new ServiceDescriptor(typeof(ITenantStore), typeof(SqlSugarTenantStore), ServiceLifetime.Transient));
services.Replace(new ServiceDescriptor(typeof(IConnectionStringResolver),
typeof(NPinMultiTenantConnectionStringResolver), ServiceLifetime.Transient));
}
}

@ -0,0 +1,152 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
namespace NPin.Framework.TenantManagement.Domain;
/// <summary>
/// 数据库连接字符串解析器,替代原有
/// </summary>
[Dependency(ReplaceServices = true)]
public class NPinMultiTenantConnectionStringResolver : DefaultConnectionStringResolver
{
private readonly ICurrentTenant _currentTenant;
private readonly IServiceProvider _serviceProvider;
public NPinMultiTenantConnectionStringResolver(IOptionsMonitor<AbpDbConnectionOptions> options,
ICurrentTenant currentTenant, IServiceProvider serviceProvider) : base(options)
{
_currentTenant = currentTenant;
_serviceProvider = serviceProvider;
}
public override async Task<string> ResolveAsync(string? connectionStringName = null)
{
if (_currentTenant.Id == null)
{
// 无租户信息,使用原有解析器
return await base.ResolveAsync(connectionStringName);
}
// 通过Store寻找租户缓存
var tenant = await FindTenantConfigurationAsync(_currentTenant.Id.Value);
if (tenant == null || tenant.ConnectionStrings.IsNullOrEmpty())
{
// 找不到租户缓存,使用原有解析器
return await base.ResolveAsync(connectionStringName);
}
var tenantDefaultConnectionString = tenant.ConnectionStrings?.Default;
var connString = tenant.ConnectionStrings?.FirstOrDefault().Value;
if (!connString.IsNullOrWhiteSpace())
{
return connString;
}
// 库隔离
var database = Options.Databases.GetMappedDatabaseOrNull(connectionStringName);
if (database is { IsUsedByTenants: true })
{
connString = tenant.ConnectionStrings?.GetOrDefault(database.DatabaseName);
if (!connString.IsNullOrWhiteSpace())
{
return connString;
}
}
if (!tenantDefaultConnectionString.IsNullOrWhiteSpace())
{
return tenantDefaultConnectionString;
}
return await base.ResolveAsync(connectionStringName);
}
protected virtual async Task<TenantConfiguration?> FindTenantConfigurationAsync(Guid tenantId)
{
using var serviceScope = _serviceProvider.CreateScope();
var tenantStore = serviceScope
.ServiceProvider
.GetRequiredService<ITenantStore>();
return await tenantStore.FindAsync(tenantId);
}
[Obsolete("Use ResolveAsync Instead.")]
public override string Resolve(string? connectionStringName = null)
{
if (_currentTenant.Id == null)
{
// 无租户信息,使用原有解析器
return base.Resolve(connectionStringName);
}
// 通过Store寻找租户缓存
var tenant = FindTenantConfiguration(_currentTenant.Id.Value);
if (tenant == null || tenant.ConnectionStrings.IsNullOrEmpty())
{
// 找不到租户缓存,使用原有解析器
return base.Resolve(connectionStringName);
}
var tenantDefaultConnectionString = tenant.ConnectionStrings?.Default;
// Requesting default connection string...
if (connectionStringName == null ||
connectionStringName == ConnectionStrings.DefaultConnectionStringName)
{
//Return tenant's default or global default
return !tenantDefaultConnectionString.IsNullOrWhiteSpace()
? tenantDefaultConnectionString!
: Options.ConnectionStrings.Default!;
}
// Requesting specific connection string...
var connString = tenant.ConnectionStrings?.GetOrDefault(connectionStringName);
if (!connString.IsNullOrWhiteSpace())
{
// Found for the tenant
return connString!;
}
// Fallback to tenant's default connection string if available
if (!tenantDefaultConnectionString.IsNullOrWhiteSpace())
{
return tenantDefaultConnectionString!;
}
// Try to find the specific connection string for given name
var connStringInOptions = Options.ConnectionStrings.GetOrDefault(connectionStringName);
if (!connStringInOptions.IsNullOrWhiteSpace())
{
return connStringInOptions!;
}
// Fallback to the global default connection string
var defaultConnectionString = Options.ConnectionStrings.Default;
if (!defaultConnectionString.IsNullOrWhiteSpace())
{
return defaultConnectionString!;
}
throw new AbpException("No connection string defined!");
}
[Obsolete("Use FindTenantConfigurationAsync Instead.")]
protected virtual TenantConfiguration? FindTenantConfiguration(Guid tenantId)
{
using var serviceScope = _serviceProvider.CreateScope();
var tenantStore = serviceScope
.ServiceProvider
.GetRequiredService<ITenantStore>();
return tenantStore.Find(tenantId);
}
}

@ -0,0 +1,124 @@
using JetBrains.Annotations;
using NPin.Framework.SqlSugarCore.Abstractions;
using Volo.Abp;
using Volo.Abp.Caching;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
namespace NPin.Framework.TenantManagement.Domain;
/// <summary>
/// 实现TenantStore
/// </summary>
public class SqlSugarTenantStore: ITenantStore
{
private ISqlSugarTenantRepository TenantRepository { get; }
protected ICurrentTenant CurrentTenant { get; }
protected IDistributedCache<TenantCacheItem> Cache { get; }
public SqlSugarTenantStore(ISqlSugarTenantRepository tenantRepository, ICurrentTenant currentTenant, IDistributedCache<TenantCacheItem> cache)
{
TenantRepository = tenantRepository;
CurrentTenant = currentTenant;
Cache = cache;
}
public Task<TenantConfiguration?> FindAsync(string name)
{
throw new NotImplementedException();
}
public Task<TenantConfiguration?> FindAsync(Guid id)
{
throw new NotImplementedException();
}
protected virtual async Task<TenantCacheItem> GetCacheItemAsync(Guid? id, string name)
{
var cacheKey = CalculateCacheKey(id, name);
var cacheItem = await Cache.GetAsync(cacheKey, considerUow: true);
if (cacheItem != null)
{
return cacheItem;
}
if (id.HasValue)
{
using (CurrentTenant.Change(null))
{
var tenant = await TenantRepository.FindAsync(id.Value);
return await SetCacheAsync(cacheKey, tenant);
}
}
if (!name.IsNullOrWhiteSpace())
{
using (CurrentTenant.Change(null))
{
var tenant = await TenantRepository.FindByNameAsync(name);
return await SetCacheAsync(cacheKey, tenant);
}
}
throw new AbpException("Id和Name不能都为空");
}
protected virtual async Task<TenantCacheItem> SetCacheAsync(string cacheKey, TenantAggregateRoot? tenant)
{
var tenantConfiguration = tenant != null ? MapToConfiguration(tenant) : null;
var cacheItem = new TenantCacheItem(tenantConfiguration);
await Cache.SetAsync(cacheKey, cacheItem, considerUow: true);
return cacheItem;
}
private TenantConfiguration MapToConfiguration(TenantAggregateRoot tenantAggregateRoot)
{
var tenantConfiguration = new TenantConfiguration
{
Id = tenantAggregateRoot.Id,
Name = tenantAggregateRoot.Name,
ConnectionStrings = MapToString(tenantAggregateRoot.TenantConnectionString),
IsActive = true
};
return tenantConfiguration;
}
private ConnectionStrings? MapToString(string tenantConnectionString)
{
//tenantConnectionString = tenantConnectionString.TrimEnd(';');
//var strSpiteds = tenantConnectionString.Split(";");
//if (strSpiteds.Count() == 0)
//{
// return null;
//}
var connectionStrings = new ConnectionStrings();
//foreach (string strSpited in strSpiteds)
//{
// var key = strSpited.Split('=')[0];
// var value = strSpited.Split('=')[1];
// connectionStrings[key] = value;
//}
connectionStrings["test"] = tenantConnectionString;
return connectionStrings;
}
protected virtual string CalculateCacheKey(Guid? id, string name)
{
return TenantCacheItem.CalculateCacheKey(id, name);
}
public TenantConfiguration? Find(string name)
{
throw new NotImplementedException("请使用异步方法");
}
public TenantConfiguration? Find(Guid id)
{
throw new NotImplementedException("请使用异步方法");
}
}

@ -0,0 +1,50 @@
using JetBrains.Annotations;
using NPin.Framework.SqlSugarCore.Abstractions;
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.TenantManagement;
using Check = Volo.Abp.Check;
namespace NPin.Framework.TenantManagement.Domain;
[SugarTable("NPinTenant")]
[MasterTenant]
public class TenantAggregateRoot : FullAuditedAggregateRoot<Guid>, IHasEntityVersion
{
[SugarColumn(IsPrimaryKey = true)] public override Guid Id { get; protected set; }
public virtual string Name { get; protected set; }
public int EntityVersion { get; protected set; }
public string TenantConnectionString { get; protected set; }
public DbType DbType { get; protected set; }
[SugarColumn(IsIgnore = true)]
public override ExtraPropertyDictionary ExtraProperties
{
get => base.ExtraProperties;
protected set => base.ExtraProperties = value;
}
public virtual void SetConnectionString(DbType dbType, string connectionString)
{
DbType = dbType;
TenantConnectionString = connectionString;
}
protected internal virtual void SetName([NotNull] string name)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), TenantConsts.MaxNameLength);
}
public TenantAggregateRoot()
{
}
protected internal TenantAggregateRoot(Guid id, [NotNull] string name) : base(id)
{
SetName(name);
}
}

@ -0,0 +1,34 @@
using Volo.Abp;
using Volo.Abp.MultiTenancy;
namespace NPin.Framework.TenantManagement.Domain;
[Serializable]
[IgnoreMultiTenancy]
public class TenantCacheItem
{
private const string CacheKeyFormat = "i:{0},n:{1}";
public TenantConfiguration Value { get; set; }
public TenantCacheItem()
{
}
public TenantCacheItem(TenantConfiguration value)
{
Value = value;
}
public static string CalculateCacheKey(Guid? id, string name)
{
if (id == null && name.IsNullOrWhiteSpace())
{
throw new AbpException("Id和Name都为空");
}
return string.Format(CacheKeyFormat,
id?.ToString() ?? "null",
name.IsNullOrWhiteSpace() ? "null" : name);
}
}

@ -0,0 +1,17 @@
using NPin.Framework.SqlSugarCore.Abstractions;
using Volo.Abp.MultiTenancy;
namespace NPin.Framework.TenantManagement.Domain;
public static class TenantManagementExtensions
{
public static IDisposable ChangeMaster(this ICurrentTenant currentTenant)
{
return currentTenant.Change(null, DbConnOptions.MasterTenantName);
}
public static IDisposable ChangeDefault(this ICurrentTenant currentTenant)
{
return currentTenant.Change(null, DbConnOptions.DefaultTenantName);
}
}

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" />
<ProjectReference Include="..\NPin.Framework.TenantManagement.Domain\NPin.Framework.TenantManagement.Domain.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using NPin.Framework.TenantManagement.Domain;
using Volo.Abp.Modularity;
namespace NPin.Framework.TenantManagement.SqlSugarCore;
[DependsOn(typeof(NPinFrameworkTenantManagementDomainModule))]
public class NPinFrameworkTenantManagementSqlSugarCoreModule : AbpModule
{
}

@ -0,0 +1,35 @@
using NPin.Framework.SqlSugarCore.Abstractions;
using NPin.Framework.SqlSugarCore.Repositories;
using NPin.Framework.TenantManagement.Domain;
using Volo.Abp.DependencyInjection;
namespace NPin.Framework.TenantManagement.SqlSugarCore;
public class SqlSugarTenantRepository : SqlSugarRepository<TenantAggregateRoot, Guid>, ISqlSugarTenantRepository,
ITransientDependency
{
public SqlSugarTenantRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(
sugarDbContextProvider)
{
}
public async Task<TenantAggregateRoot> FindByNameAsync(string name, bool includeDetails = true)
{
return await DbQueryable.FirstAsync(x => x.Name == name);
}
public async Task<List<TenantAggregateRoot>> GetListAsync(string sorting = null,
int maxResultCount = Int32.MaxValue, int skipCount = 0, string filter = null,
bool includeDetails = false)
{
return await DbQueryable
.WhereIF(!string.IsNullOrEmpty(filter), x => x.Name.Contains(filter))
.OrderByIF(!string.IsNullOrEmpty(sorting), sorting)
.ToPageListAsync(skipCount, maxResultCount);
}
public async Task<long> GetCountAsync(string filter = null)
{
return await DbQueryable.WhereIF(!string.IsNullOrEmpty(filter), x => x.Name.Contains(filter)).CountAsync();
}
}

@ -8,6 +8,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Ddd.Application.Contracts\NPin.Framework.Ddd.Application.Contracts.csproj" /> <ProjectReference Include="..\..\framework\NPin.Framework.Ddd.Application.Contracts\NPin.Framework.Ddd.Application.Contracts.csproj" />
<ProjectReference Include="..\..\module\tenant-management\NPin.Framework.TenantManagement.Application.Contracts\NPin.Framework.TenantManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" /> <ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,5 +1,6 @@
using NPin.Domain.Shared; using NPin.Domain.Shared;
using NPin.Framework.Ddd.Application.Contracts; using NPin.Framework.Ddd.Application.Contracts;
using NPin.Framework.TenantManagement.Application.Contracts;
namespace NPin.Application.Contracts; namespace NPin.Application.Contracts;
@ -7,9 +8,9 @@ namespace NPin.Application.Contracts;
typeof(NPinDomainSharedModule), typeof(NPinDomainSharedModule),
// TODO RBAC // TODO RBAC
// TODO Bbs // TODO Bbs
// TODO Tenant typeof(NPinFrameworkTenantManagementApplicationContractsModule),
typeof(NPinFrameworkDddApplicationContractsModule))] typeof(NPinFrameworkDddApplicationContractsModule)
)]
public class NPinApplicationContractsModule : AbpModule public class NPinApplicationContractsModule : AbpModule
{ {
} }

@ -2,6 +2,7 @@
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Framework\NPin.Framework.Ddd.Application\NPin.Framework.Ddd.Application.csproj" /> <ProjectReference Include="..\..\Framework\NPin.Framework.Ddd.Application\NPin.Framework.Ddd.Application.csproj" />
<ProjectReference Include="..\..\module\tenant-management\NPin.Framework.TenantManagement.Application\NPin.Framework.TenantManagement.Application.csproj" />
<ProjectReference Include="..\NPin.Application.Contracts\NPin.Application.Contracts.csproj" /> <ProjectReference Include="..\NPin.Application.Contracts\NPin.Application.Contracts.csproj" />
<ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" /> <ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" />
</ItemGroup> </ItemGroup>
@ -10,4 +11,8 @@
<Folder Include="Jobs\" /> <Folder Include="Jobs\" />
<Folder Include="Services\" /> <Folder Include="Services\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
</ItemGroup>
</Project> </Project>

@ -1,16 +1,18 @@
using NPin.Application.Contracts; using NPin.Application.Contracts;
using NPin.Domain; using NPin.Domain;
using NPin.Framework.Ddd.Application; using NPin.Framework.Ddd.Application;
using NPin.Framework.Ddd.Application.Contracts; using NPin.Framework.TenantManagement.Application;
namespace NPin.Application; namespace NPin.Application;
[DependsOn( [DependsOn(
typeof(NPinApplicationContractsModule), typeof(NPinApplicationContractsModule),
typeof(NPinDomainModule), typeof(NPinDomainModule),
// TODO rbac bbs tenant codegen // TODO rbac bbs
typeof(NPinFrameworkTenantManagementApplicationModule),
// TODO code-gen
typeof(NPinFrameworkDddApplicationModule) typeof(NPinFrameworkDddApplicationModule)
)] )]
public class NPinApplicationModule: AbpModule public class NPinApplicationModule : AbpModule
{ {
} }

@ -9,7 +9,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="8.0.4" /> <PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="8.0.0" />
<PackageReference Include="Volo.Abp.Users.Domain.Shared" Version="8.0.4" /> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\module\audit-logging\NPin.Framework.AuditLogging.Domain.Shared\NPin.Framework.AuditLogging.Domain.Shared.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,10 +1,13 @@
namespace NPin.Domain.Shared; using NPin.Framework.AuditLogging.Domain.Shared;
using Volo.Abp.Domain;
namespace NPin.Domain.Shared;
[DependsOn( [DependsOn(
// TODO RBAC // TODO RBAC
// TODO BBS // TODO BBS
// TODO AuditLogging typeof(NPinFrameworkAuditLoggingDomainSharedModule),
// TODO AbpDddDomainSharedModule typeof(AbpDddDomainSharedModule)
)] )]
public class NPinDomainSharedModule : AbpModule public class NPinDomainSharedModule : AbpModule
{ {

@ -11,6 +11,13 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" /> <ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" /> <ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore.Abstractions\NPin.Framework.SqlSugarCore.Abstractions.csproj" />
<ProjectReference Include="..\..\module\audit-logging\NPin.Framework.AuditLogging.Domain\NPin.Framework.AuditLogging.Domain.csproj" />
<ProjectReference Include="..\..\module\tenant-management\NPin.Framework.TenantManagement.Domain\NPin.Framework.TenantManagement.Domain.csproj" />
<ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" /> <ProjectReference Include="..\NPin.Domain.Shared\NPin.Domain.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Caching" Version="8.0.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="8.0.0" />
</ItemGroup>
</Project> </Project>

@ -1,5 +1,7 @@
using NPin.Domain.Shared; using NPin.Domain.Shared;
using NPin.Framework.AuditLogging.Domain;
using NPin.Framework.Mapster; using NPin.Framework.Mapster;
using NPin.Framework.TenantManagement.Domain;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Domain; using Volo.Abp.Domain;
@ -7,10 +9,12 @@ namespace NPin.Domain;
[DependsOn( [DependsOn(
typeof(NPinDomainSharedModule), typeof(NPinDomainSharedModule),
// TODO Tenant //
typeof(NPinFrameworkTenantManagementDomainModule),
// TODO Rbac // TODO Rbac
// TODO Bbs // TODO Bbs
// TODO Audit typeof(NPinFrameworkAuditLoggingDomainModule),
//
typeof(NPinFrameworkMapsterModule), typeof(NPinFrameworkMapsterModule),
typeof(AbpDddDomainModule), typeof(AbpDddDomainModule),
typeof(AbpCachingModule) typeof(AbpCachingModule)

@ -9,7 +9,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" /> <ProjectReference Include="..\..\framework\NPin.Framework.Mapster\NPin.Framework.Mapster.csproj" />
<ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" /> <ProjectReference Include="..\..\framework\NPin.Framework.SqlSugarCore\NPin.Framework.SqlSugarCore.csproj" />
<ProjectReference Include="..\..\module\NPin.Framework.AuditLogging.SqlSugarCore\NPin.Framework.AuditLogging.SqlSugarCore.csproj" /> <ProjectReference Include="..\..\module\audit-logging\NPin.Framework.AuditLogging.SqlSugarCore\NPin.Framework.AuditLogging.SqlSugarCore.csproj" />
<ProjectReference Include="..\..\module\tenant-management\NPin.Framework.TenantManagement.SqlSugarCore\NPin.Framework.TenantManagement.SqlSugarCore.csproj" />
<ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" /> <ProjectReference Include="..\NPin.Domain\NPin.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -2,6 +2,7 @@
using NPin.Framework.AuditLogging.SqlSugarCore; using NPin.Framework.AuditLogging.SqlSugarCore;
using NPin.Framework.Mapster; using NPin.Framework.Mapster;
using NPin.Framework.SqlSugarCore; using NPin.Framework.SqlSugarCore;
using NPin.Framework.TenantManagement.SqlSugarCore;
namespace NPin.SqlSugarCore; namespace NPin.SqlSugarCore;
@ -9,7 +10,8 @@ namespace NPin.SqlSugarCore;
typeof(NPinDomainModule), typeof(NPinDomainModule),
// TODO rbac bbs codegen // TODO rbac bbs codegen
typeof(NPinFrameworkAuditLoggingSqlSugarCoreModule), typeof(NPinFrameworkAuditLoggingSqlSugarCoreModule),
// TODO tenant typeof(NPinFrameworkTenantManagementSqlSugarCoreModule),
//
typeof(NPinFrameworkMapsterModule), typeof(NPinFrameworkMapsterModule),
typeof(NPinFrameworkSqlSugarCoreModule) typeof(NPinFrameworkSqlSugarCoreModule)
)] )]

@ -7,15 +7,16 @@
<Import Project="..\..\common.props"/> <Import Project="..\..\common.props"/>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2"/> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1"/> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0"/>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1"/> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0"/>
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0"/> <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0"/>
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.0.3"/> <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="8.0.0"/>
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.0.3"/> <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.0.0"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.3"/> <PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.0.0"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.0.3"/> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.0.0"/>
<PackageReference Include="Volo.Abp.Autofac" Version="8.0.3"/> <PackageReference Include="Volo.Abp.Autofac" Version="8.0.0"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -1,6 +0,0 @@
@NPin_HostAddress = http://localhost:5122
GET {{NPin_HostAddress}}/weatherforecast/
Accept: application/json
###

@ -9,11 +9,13 @@ using NPin.Framework.AspNetCore.Authentication.OAuth.Gitee;
using NPin.Framework.AspNetCore.Authentication.OAuth.QQ; using NPin.Framework.AspNetCore.Authentication.OAuth.QQ;
using NPin.Framework.AspNetCore.Microsoft.AspNetCore.Builder; using NPin.Framework.AspNetCore.Microsoft.AspNetCore.Builder;
using NPin.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; using NPin.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection;
using NPin.Framework.TenantManagement.Application;
using NPin.SqlSugarCore; using NPin.SqlSugarCore;
using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Caching; using Volo.Abp.Caching;
@ -30,6 +32,7 @@ namespace NPin;
typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreMvcModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule), typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAuditingModule), typeof(AbpAuditingModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
// Framework modules // Framework modules
@ -60,7 +63,9 @@ public class NPinWebModule : AbpModule
opt.ConventionalControllers.Create(typeof(NPinApplicationModule).Assembly, opt.ConventionalControllers.Create(typeof(NPinApplicationModule).Assembly,
opts => opts.RemoteServiceName = "default"); opts => opts.RemoteServiceName = "default");
// TODO 添加其它模块的动态API // TODO 添加其它模块的动态API
// Rbac bbs tenant code-gen // TODO Rbac bbs code-gen
opt.ConventionalControllers.Create(typeof(NPinFrameworkTenantManagementApplicationModule).Assembly,
opts => opts.RemoteServiceName = "tenant-management");
}); });
// Api格式配置 // Api格式配置
@ -125,8 +130,8 @@ public class NPinWebModule : AbpModule
// var jwtOptions = configuration.GetSection(nameof(JwtOptions)) // var jwtOptions = configuration.GetSection(nameof(JwtOptions))
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(opt => { }) // .AddJwtBearer(opt => { })
.AddJwtBearer(opt => { }) // .AddJwtBearer(opt => { })
.AddQQ(opt => { configuration.GetSection("OAuth:QQ").Bind(opt); }) .AddQQ(opt => { configuration.GetSection("OAuth:QQ").Bind(opt); })
.AddGitee(opt => { configuration.GetSection("OAuth:Gitee").Bind(opt); }); .AddGitee(opt => { configuration.GetSection("OAuth:Gitee").Bind(opt); });

@ -1,41 +1,15 @@
{ {
"$schema": "http://json.schemastore.org/launchsettings.json", "$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:27344",
"sslPort": 44340
}
},
"profiles": { "profiles": {
"http": { "NPin.Web": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "http://localhost:5122",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} },
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "applicationUrl": "http://localhost:19001"
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7122;http://localhost:5122",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
} }
} }
} }

@ -1,12 +1,10 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
// "Default": "Information",
"Default": "Debug", "Default": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*",
"App": { "App": {
"SelfUrl": "http://*:19001", "SelfUrl": "http://*:19001",
"CorsOrigins": "http://localhost:19001;http://localhost:18000" "CorsOrigins": "http://localhost:19001;http://localhost:18000"
@ -19,6 +17,50 @@
"Postgresql" "Postgresql"
], ],
"DbConnOptions": { "DbConnOptions": {
"Url": "DataSource=np-dev.db",
"DbType": "Sqlite",
"EnabledReadWrite": false,
"EnabledCodeFirst": true,
"EnabledSqlLog": true,
"EnabledDbSeed": true,
"EnabledSaasMultiTenancy": false
},
"Redis": {
"IsEnabled": false,
"Configuration": "192.168.1.100:6379,password=,defaultDatabase=10"
},
"JwtOptions": {
"Issuer": "NoahLan",
"Audience": "NoahLan",
"SecurityKey": "zqxwcevrbtnymu312412ihe9rfwhe78rh23djoi32hrui3ryf9e8wfh34iuj54y0934uti4h97fgw7hf97wyh8yy69520",
"ExpiresMinuteTime": 86400
},
"RefreshJwtOptions": {
"Issuer": "NoahLan",
"Audience": "NoahLan",
"SecurityKey": "67ij4o6jo4i5j6io45j6i4j74p5k6i54ojoi5t9g8ergoj34ofgkrtbmreog894jbioemgropihj48rj4io5juopjgior",
"ExpiresMinuteTime": 172800
},
"OAuth": {
"QQ": {
"ClientId": "",
"ClientSecret": "",
"RedirectUri": ""
},
"Gitee": {
"ClientId": "",
"ClientSecret": "",
"RedirectUri": ""
}
},
"RbacOptions": {
//
"AdminPassword": "123456",
//
"EnableCaptcha": true,
//
"EnableRegister": false,
//
"EnableDataBaseBackup": false
} }
} }

@ -0,0 +1,327 @@
2024-02-22 15:07:12.338 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 15:17:54.753 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 15:25:21.415 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 15:30:54.930 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 15:40:34.731 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 16:18:43.136 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.IOnServiceExposingContext.get_ExposedTypes()'.
at Volo.Abp.ObjectMapping.AbpObjectMappingModule.<>c.<PreConfigureServices>b__0_0(IOnServiceExposingContext onServiceExposingContext)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.TriggerServiceExposing(IServiceCollection services, Type implementationType, List`1 serviceTypes)
at Volo.Abp.DependencyInjection.DefaultConventionalRegistrar.AddType(IServiceCollection services, Type type)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddTypes(IServiceCollection services, Type[] types)
at Volo.Abp.DependencyInjection.ConventionalRegistrarBase.AddAssembly(IServiceCollection services, Assembly assembly)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionConventionalRegistrationExtensions.AddAssembly(IServiceCollection services, Assembly assembly)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 30
2024-02-22 16:23:43.692 +08:00 [FTL] Application startup exception
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Microsoft.AspNetCore.Authentication.AuthenticationOptions])' on type 'AuthenticationSchemeProvider'.
---> System.InvalidOperationException: Scheme already exists: Bearer
at Microsoft.AspNetCore.Authentication.AuthenticationOptions.AddScheme(String name, Action`1 configureBuilder)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider..ctor(IOptions`1 options, IDictionary`2 schemes)
at lambda_method181(Closure, Object[])
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CoreEventMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.Core.Container.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate next)
at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-02-22 16:23:43.693 +08:00 [ERR] Hosting failed to start
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Microsoft.AspNetCore.Authentication.AuthenticationOptions])' on type 'AuthenticationSchemeProvider'.
---> System.InvalidOperationException: Scheme already exists: Bearer
at Microsoft.AspNetCore.Authentication.AuthenticationOptions.AddScheme(String name, Action`1 configureBuilder)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider..ctor(IOptions`1 options, IDictionary`2 schemes)
at lambda_method181(Closure, Object[])
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CoreEventMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.Core.Container.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate next)
at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-02-22 16:23:43.702 +08:00 [FTL] NPin-Framework (Abp.vNext) 爆炸!
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Microsoft.AspNetCore.Authentication.AuthenticationOptions])' on type 'AuthenticationSchemeProvider'.
---> System.InvalidOperationException: Scheme already exists: Bearer
at Microsoft.AspNetCore.Authentication.AuthenticationOptions.AddScheme(String name, Action`1 configureBuilder)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider..ctor(IOptions`1 options, IDictionary`2 schemes)
at lambda_method181(Closure, Object[])
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CoreEventMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.Core.Container.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware(RequestDelegate next)
at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Program.<Main>$(String[] args) in D:\Projects\.NetCore\NPin\src\NPin.Web\Program.cs:line 33
2024-02-22 16:24:56.510 +08:00 [ERR] An unhandled exception has occurred while executing the request.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware -> Volo.Abp.MultiTenancy.TenantConfigurationProvider -> NPin.Framework.TenantManagement.Domain.TenantStore.
---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'NPin.Framework.TenantManagement.Domain.TenantStore' can be invoked with the available services and parameters:
Cannot resolve parameter 'NPin.Framework.TenantManagement.Domain.ISqlSugarTenantRepository tenantRepository' of constructor 'Void .ctor(NPin.Framework.TenantManagement.Domain.ISqlSugarTenantRepository, Volo.Abp.MultiTenancy.ICurrentTenant, Volo.Abp.Caching.IDistributedCache`1[NPin.Framework.TenantManagement.Domain.TenantCacheItem])'.
See https://autofac.rtfd.io/help/no-constructors-bindable for more info.
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CoreEventMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.AspNetCore.Http.MiddlewareFactory.Create(Type middlewareType)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
2024-02-22 16:24:58.096 +08:00 [ERR] An unhandled exception has occurred while executing the request.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware -> Volo.Abp.MultiTenancy.TenantConfigurationProvider -> NPin.Framework.TenantManagement.Domain.TenantStore.
---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'NPin.Framework.TenantManagement.Domain.TenantStore' can be invoked with the available services and parameters:
Cannot resolve parameter 'NPin.Framework.TenantManagement.Domain.ISqlSugarTenantRepository tenantRepository' of constructor 'Void .ctor(NPin.Framework.TenantManagement.Domain.ISqlSugarTenantRepository, Volo.Abp.MultiTenancy.ICurrentTenant, Volo.Abp.Caching.IDistributedCache`1[NPin.Framework.TenantManagement.Domain.TenantCacheItem])'.
See https://autofac.rtfd.io/help/no-constructors-bindable for more info.
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CoreEventMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext context)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.AspNetCore.Http.MiddlewareFactory.Create(Type middlewareType)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

File diff suppressed because it is too large Load Diff

Binary file not shown.
Loading…
Cancel
Save