Browse Source

feat:

1. Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy替换为Volo.Abp.AspNetCore.MultiTenancy
2. 移除多余Volo.Abp.AspNetCore.Authentication.JwtBearer依赖
3. 调整redis配置通过setting配置
4. 调整configservice
5. 优化模板
main
wangjunzzz 2 months ago
parent
commit
94bbf4965b
  1. 2
      aspnet-core/Directory.Build.Volo.targets
  2. 1
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj
  3. 7
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs
  4. 2
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
  5. 2
      aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs
  6. 5
      aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/BasicManagementHttpApiHostModule.cs
  7. 2
      aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/GlobalUsings.cs
  8. 6
      aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj
  9. 5
      aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs
  10. 4
      aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/GlobalUsings.cs
  11. 6
      aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj
  12. 2
      aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs
  13. 15
      aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj
  14. 4
      aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/GlobalUsings.cs
  15. 5
      aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs
  16. 6
      aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj
  17. 14
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj
  18. 2
      aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs
  19. 31
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
  20. 9
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs
  21. 6
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
  22. 106
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
  23. 7
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json
  24. 6
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json
  25. 2
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
  26. 2
      aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs
  27. 2
      aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
  28. 2
      aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj
  29. 2
      aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj
  30. 5
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
  31. 3
      aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj
  32. 3
      aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj
  33. 1
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/EntityFrameworkCore/MyModuleNameHttpApiHostMigrationsDbContextFactory.cs
  34. 5
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/GlobalUsings.cs
  35. 17
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
  36. 12
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj
  37. 4
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs
  38. 7
      templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json
  39. BIN
      templates/pro-module/icon.png
  40. 2
      templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Application/GlobalUsings.cs
  41. 2
      templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Domain/GlobalUsings.cs
  42. 2
      templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/GlobalUsings.cs
  43. 7
      templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs
  44. 1
      templates/pro-nuget/service/Directory.Build.targets
  45. 7
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/GlobalUsings.cs
  46. 109
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
  47. 7
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj
  48. 111
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
  49. 68
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.Development.json
  50. 2
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/GlobalUsings.cs
  51. 6
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs
  52. 2
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs
  53. BIN
      templates/pro-nuget/service/icon.png
  54. 5
      templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs

2
aspnet-core/Directory.Build.Volo.targets

@ -27,11 +27,9 @@
<PackageReference Update="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="10.0.1"/> <PackageReference Update="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="10.0.1"/> <PackageReference Update="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="10.0.1"/> <PackageReference Update="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc.Contracts" Version="10.0.1"/> <PackageReference Update="Volo.Abp.AspNetCore.Mvc.Contracts" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.Account.Web" Version="10.0.1"/> <PackageReference Update="Volo.Abp.Account.Web" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.Caching.StackExchangeRedis" Version="10.0.1"/> <PackageReference Update="Volo.Abp.Caching.StackExchangeRedis" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="10.0.1"/> <PackageReference Update="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.AspNetCore.Serilog" Version="10.0.1"/> <PackageReference Update="Volo.Abp.AspNetCore.Serilog" Version="10.0.1"/>
<PackageReference Update="Volo.Abp.Ddd.Application" Version="10.0.1"/> <PackageReference Update="Volo.Abp.Ddd.Application" Version="10.0.1"/>

1
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj

@ -19,6 +19,7 @@
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" /> <PackageReference Include="MiniProfiler.AspNetCore.Mvc" />
<PackageReference Include="MiniProfiler.EntityFrameworkCore" /> <PackageReference Include="MiniProfiler.EntityFrameworkCore" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

7
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs

@ -1,7 +1,14 @@
using Lion.AbpPro.AspNetCore.Options; using Lion.AbpPro.AspNetCore.Options;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
namespace Lion.AbpPro.AspNetCore; namespace Lion.AbpPro.AspNetCore;
[DependsOn(
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
)
]
public class AbpProAspNetCoreModule : AbpModule public class AbpProAspNetCoreModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)

2
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

@ -229,7 +229,7 @@ public static class ServiceCollectionExtensions
/// <summary> /// <summary>
/// 配置JWT /// 配置JWT
/// </summary> /// </summary>
public static IServiceCollection AddAbpProAuthentication(this IServiceCollection service) public static IServiceCollection AddAbpProJwtBearer(this IServiceCollection service)
{ {
var jwtOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProJwtOptions>>().Value; var jwtOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProJwtOptions>>().Value;
var cookieOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProCookieOptions>>().Value; var cookieOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProCookieOptions>>().Value;

2
aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs

@ -15,6 +15,8 @@ public static class ReplacePackageReferenceExtensions
"<PackageReference Include=\"Lion.AbpPro.Shared.Hosting.Gateways\"/>") "<PackageReference Include=\"Lion.AbpPro.Shared.Hosting.Gateways\"/>")
.Replace("<ProjectReference Include=\"..\\..\\..\\..\\..\\aspnet-core\\frameworks\\src\\Lion.AbpPro.AspNetCore\\Lion.AbpPro.AspNetCore.csproj\"/>", .Replace("<ProjectReference Include=\"..\\..\\..\\..\\..\\aspnet-core\\frameworks\\src\\Lion.AbpPro.AspNetCore\\Lion.AbpPro.AspNetCore.csproj\"/>",
"<PackageReference Include=\"Lion.AbpPro.AspNetCore\"/>") "<PackageReference Include=\"Lion.AbpPro.AspNetCore\"/>")
.Replace("<ProjectReference Include=\"..\\..\\..\\..\\aspnet-core\\frameworks\\src\\Lion.AbpPro.AspNetCore\\Lion.AbpPro.AspNetCore.csproj\"/>",
"<PackageReference Include=\"Lion.AbpPro.AspNetCore\"/>")
; ;
} }

5
aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/BasicManagementHttpApiHostModule.cs

@ -1,3 +1,4 @@
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.EntityFrameworkCore.PostgreSql; using Volo.Abp.EntityFrameworkCore.PostgreSql;
namespace Lion.AbpPro.BasicManagement; namespace Lion.AbpPro.BasicManagement;
@ -6,7 +7,7 @@ namespace Lion.AbpPro.BasicManagement;
typeof(BasicManagementApplicationModule), typeof(BasicManagementApplicationModule),
typeof(BasicManagementEntityFrameworkCoreModule), typeof(BasicManagementEntityFrameworkCoreModule),
typeof(BasicManagementHttpApiModule), typeof(BasicManagementHttpApiModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCorePostgreSqlModule), typeof(AbpEntityFrameworkCorePostgreSqlModule),
@ -26,7 +27,7 @@ public class BasicManagementHttpApiHostModule : AbpModule
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()

2
aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/GlobalUsings.cs

@ -12,7 +12,7 @@ global using StackExchange.Redis;
global using Swashbuckle.AspNetCore.SwaggerUI; global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AspNetCore.ExceptionHandling; global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.Autofac; global using Volo.Abp.Autofac;
global using Volo.Abp.Caching; global using Volo.Abp.Caching;

6
aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj

@ -9,14 +9,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" />

5
aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs

@ -1,6 +1,7 @@
using Lion.AbpPro.AspNetCore; using Lion.AbpPro.AspNetCore;
using Microsoft.OpenApi; using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerUI; using Swashbuckle.AspNetCore.SwaggerUI;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.EntityFrameworkCore.PostgreSql; using Volo.Abp.EntityFrameworkCore.PostgreSql;
namespace Lion.AbpPro.DataDictionaryManagement namespace Lion.AbpPro.DataDictionaryManagement
@ -9,7 +10,7 @@ namespace Lion.AbpPro.DataDictionaryManagement
typeof(DataDictionaryManagementApplicationModule), typeof(DataDictionaryManagementApplicationModule),
typeof(DataDictionaryManagementEntityFrameworkCoreModule), typeof(DataDictionaryManagementEntityFrameworkCoreModule),
typeof(DataDictionaryManagementHttpApiModule), typeof(DataDictionaryManagementHttpApiModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCorePostgreSqlModule), typeof(AbpEntityFrameworkCorePostgreSqlModule),
@ -30,7 +31,7 @@ namespace Lion.AbpPro.DataDictionaryManagement
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()

4
aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/GlobalUsings.cs

@ -21,8 +21,8 @@ global using Serilog.Events;
global using StackExchange.Redis; global using StackExchange.Redis;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.AuditLogging.EntityFrameworkCore; global using Volo.Abp.AuditLogging.EntityFrameworkCore;
global using Volo.Abp.Autofac; global using Volo.Abp.Autofac;

6
aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj

@ -9,13 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" />

2
aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs

@ -25,7 +25,7 @@ public class FileManagementHttpApiHostModule : AbpModule
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()

15
aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj

@ -10,25 +10,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Serilog.Exceptions" />
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" />
<PackageReference Include="Serilog.Sinks.File" />
<!-- <PackageReference Include="IdentityModel" />-->
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" />
<PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

4
aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/GlobalUsings.cs

@ -21,8 +21,8 @@ global using Serilog.Events;
global using StackExchange.Redis; global using StackExchange.Redis;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.AuditLogging.EntityFrameworkCore; global using Volo.Abp.AuditLogging.EntityFrameworkCore;
global using Volo.Abp.Autofac; global using Volo.Abp.Autofac;

5
aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs

@ -1,5 +1,6 @@
using Lion.AbpPro.AspNetCore; using Lion.AbpPro.AspNetCore;
using Swashbuckle.AspNetCore.SwaggerUI; using Swashbuckle.AspNetCore.SwaggerUI;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.EntityFrameworkCore.PostgreSql; using Volo.Abp.EntityFrameworkCore.PostgreSql;
namespace Lion.AbpPro.LanguageManagement namespace Lion.AbpPro.LanguageManagement
@ -8,7 +9,7 @@ namespace Lion.AbpPro.LanguageManagement
typeof(LanguageManagementApplicationModule), typeof(LanguageManagementApplicationModule),
typeof(LanguageManagementEntityFrameworkCoreModule), typeof(LanguageManagementEntityFrameworkCoreModule),
typeof(LanguageManagementHttpApiModule), typeof(LanguageManagementHttpApiModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCorePostgreSqlModule), typeof(AbpEntityFrameworkCorePostgreSqlModule),
@ -30,7 +31,7 @@ namespace Lion.AbpPro.LanguageManagement
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()

6
aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj

@ -10,13 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" />

14
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj

@ -9,24 +9,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Serilog.Exceptions" />
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools"/> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools"/>
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql"/> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql"/>
<PackageReference Include="Volo.Abp.Autofac"/>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog"/> <PackageReference Include="Volo.Abp.AspNetCore.Serilog"/>
<PackageReference Include="Swashbuckle.AspNetCore"/>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs

@ -26,7 +26,7 @@ public class NotificationManagementHttpApiHostModule : AbpModule
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()

31
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs

@ -3,53 +3,35 @@ namespace Lion.AbpPro;
[DependsOn( [DependsOn(
typeof(AbpProHttpApiModule), typeof(AbpProHttpApiModule),
typeof(AbpProAspNetCoreModule), typeof(AbpProAspNetCoreModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpProEntityFrameworkCoreModule), typeof(AbpProEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule), typeof(AbpAccountWebModule),
typeof(AbpProApplicationModule), typeof(AbpProApplicationModule),
// typeof(AbpProCapModule),
// typeof(AbpProCapEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpDistributedLockingModule),
typeof(AbpBlobStoringFileSystemModule), typeof(AbpBlobStoringFileSystemModule),
typeof(AbpProStarterModule) typeof(AbpProStarterModule)
//typeof(AbpBackgroundJobsHangfireModule)
)] )]
public partial class AbpProHttpApiHostModule : AbpModule public partial class AbpProHttpApiHostModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context)
{
// 动态配置
// PreConfigure<AbpAspNetCoreMvcOptions>(options =>
// {
// options.ConventionalControllers.Create(typeof(AbpProApplicationModule).Assembly);
// });
}
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services context.Services
.AddAbpProAuditLog() .AddAbpProAuditLog()
.AddAbpProAuthentication() .AddAbpProJwtBearer()
.AddAbpProMultiTenancy() .AddAbpProMultiTenancy()
.AddAbpProRedis() .AddAbpProRedis()
.AddAbpProRedisDistributedLocking()
.AddAbpProMiniProfiler() .AddAbpProMiniProfiler()
.AddAbpProCors() .AddAbpProCors()
.AddAbpProAntiForgery() .AddAbpProAntiForgery()
.AddAbpProIdentity() .AddAbpProIdentity()
.AddAbpProBlobStorage() .AddAbpProBlobStorageFileSystem()
.AddAbpProSignalR() .AddAbpProSignalR()
.AddAbpProHealthChecks() .AddAbpProHealthChecks()
.AddAbpProTenantResolvers() .AddAbpProTenantResolvers()
.AddAbpProLocalization() .AddAbpProLocalization()
.AddAbpProExceptions() .AddAbpProExceptions()
.AddAbpProConsul()
.AddAbpProSwagger("AbpPro"); .AddAbpProSwagger("AbpPro");
context.Services.AddAlwaysAllowAuthorization();
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
@ -71,13 +53,6 @@ public partial class AbpProHttpApiHostModule : AbpModule
app.UseConfiguredEndpoints(endpoints => app.UseConfiguredEndpoints(endpoints =>
{ {
endpoints.MapHealthChecks("/health"); endpoints.MapHealthChecks("/health");
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
// {
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
// IgnoreAntiforgeryToken = true
// });
}); });
app.UseAbpProConsul();
} }
} }

9
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs

@ -9,12 +9,6 @@ global using System.Text.RegularExpressions;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using Consul; global using Consul;
global using Hangfire; global using Hangfire;
global using Hangfire.Common;
global using Hangfire.Dashboard;
global using Hangfire.Redis;
global using Hangfire.Redis.StackExchange;
global using Hangfire.States;
global using Hangfire.Storage;
global using Lion.AbpPro.AspNetCore; global using Lion.AbpPro.AspNetCore;
global using Lion.AbpPro.AspNetCore.Options; global using Lion.AbpPro.AspNetCore.Options;
global using Lion.AbpPro.CAP; global using Lion.AbpPro.CAP;
@ -52,12 +46,11 @@ global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.Account.Web; global using Volo.Abp.Account.Web;
global using Volo.Abp.AspNetCore.Auditing; global using Volo.Abp.AspNetCore.Auditing;
global using Volo.Abp.AspNetCore.Authentication.JwtBearer;
global using Volo.Abp.AspNetCore.ExceptionHandling; global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.MultiTenancy; global using Volo.Abp.AspNetCore.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.AntiForgery; global using Volo.Abp.AspNetCore.Mvc.AntiForgery;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.Auditing; global using Volo.Abp.Auditing;

6
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj

@ -7,25 +7,19 @@
<UserSecretsId>Lion.AbpPro-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> <UserSecretsId>Lion.AbpPro-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Account.Web"/> <PackageReference Include="Volo.Abp.Account.Web"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy"/>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog"/> <PackageReference Include="Volo.Abp.AspNetCore.Serilog"/>
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic"/>
<PackageReference Include="Volo.Abp.DistributedLocking"/> <PackageReference Include="Volo.Abp.DistributedLocking"/>
<PackageReference Include="Volo.Abp.BlobStoring.FileSystem"/> <PackageReference Include="Volo.Abp.BlobStoring.FileSystem"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/>
<PackageReference Include="DotNetCore.CAP.PostgreSql"/> <PackageReference Include="DotNetCore.CAP.PostgreSql"/>
<PackageReference Include="DotNetCore.CAP.RabbitMQ"/> <PackageReference Include="DotNetCore.CAP.RabbitMQ"/>
<PackageReference Include="DotNetCore.CAP.Dashboard"/> <PackageReference Include="DotNetCore.CAP.Dashboard"/>
<PackageReference Include="DistributedLock.Redis"/> <PackageReference Include="DistributedLock.Redis"/>
<PackageReference Include="Hangfire.Redis.StackExchange"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

106
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

@ -1,4 +1,5 @@
using Lion.AbpPro.Hangfire; using Lion.AbpPro.Hangfire;
using Microsoft.AspNetCore.SignalR.StackExchangeRedis;
#pragma warning disable CS0618 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete
@ -9,14 +10,23 @@ public static class ServiceCollectionExtensions
/// <summary> /// <summary>
/// 注册Redis缓存 /// 注册Redis缓存
/// </summary> /// </summary>
public static IServiceCollection AddAbpProRedis(this IServiceCollection service) public static IServiceCollection AddAbpProRedis(this IServiceCollection service, Action<AbpDistributedCacheOptions> configureOptions = null)
{ {
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
var configuration = service.GetConfiguration(); var configuration = service.GetConfiguration();
var redisEnabled = configuration["Redis:IsEnabled"];
if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service;
if (configureOptions != null)
{
service.Configure(configureOptions);
}
else
{
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
}
var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration")); var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration"));
service service.AddDataProtection().PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
return service; return service;
} }
@ -26,6 +36,9 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service) public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service)
{ {
var configuration = service.GetConfiguration(); var configuration = service.GetConfiguration();
var redisEnabled = configuration["Redis:IsEnabled"];
if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service;
var connectionString = configuration.GetValue<string>("Redis:Configuration"); var connectionString = configuration.GetValue<string>("Redis:Configuration");
service.AddSingleton<IDistributedLockProvider>(sp => service.AddSingleton<IDistributedLockProvider>(sp =>
{ {
@ -47,19 +60,38 @@ public static class ServiceCollectionExtensions
/// <summary> /// <summary>
/// 注册SignalR /// 注册SignalR
/// </summary> /// </summary>
public static IServiceCollection AddAbpProSignalR(this IServiceCollection service) public static IServiceCollection AddAbpProSignalR(this IServiceCollection service, Action<RedisOptions> redisOptions = null)
{ {
service var configuration = service.GetConfiguration();
.AddSignalR() var redisEnabled = configuration["Redis:IsEnabled"];
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"), if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled))
options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); {
if (redisOptions != null)
{
service
.AddSignalR()
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"), redisOptions);
}
else
{
service
.AddSignalR()
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"),
options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; });
}
}
else
{
service.AddSignalR();
}
return service; return service;
} }
/// <summary> /// <summary>
/// 注册blob设置 /// 注册基于FileSystem的blob设置
/// </summary> /// </summary>
public static IServiceCollection AddAbpProBlobStorage(this IServiceCollection service) public static IServiceCollection AddAbpProBlobStorageFileSystem(this IServiceCollection service)
{ {
service.Configure<AbpBlobStoringOptions>(options => { options.Containers.ConfigureDefault(container => { container.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\\my-files"; }); }); }); service.Configure<AbpBlobStoringOptions>(options => { options.Containers.ConfigureDefault(container => { container.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\\my-files"; }); }); });
return service; return service;
@ -87,28 +119,28 @@ public static class ServiceCollectionExtensions
return service; return service;
} }
/// <summary> // /// <summary>
/// 注册hangfire // /// 注册hangfire
/// </summary> // /// </summary>
public static IServiceCollection AddAbpProHangfire(this IServiceCollection service) // public static IServiceCollection AddAbpProHangfire(this IServiceCollection service)
{ // {
var redisStorageOptions = new RedisStorageOptions() // var redisStorageOptions = new RedisStorageOptions()
{ // {
Db = service.GetConfiguration().GetValue<int>("Hangfire:Redis:DB") // Db = service.GetConfiguration().GetValue<int>("Hangfire:Redis:DB")
}; // };
//
service.Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = true; }); // service.Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = true; });
//
service.AddHangfire(config => // service.AddHangfire(config =>
{ // {
config.UseRedisStorage(service.GetConfiguration().GetValue<string>("Hangfire:Redis:Host"), redisStorageOptions) // config.UseRedisStorage(service.GetConfiguration().GetValue<string>("Hangfire:Redis:Host"), redisStorageOptions)
.WithJobExpirationTimeout(TimeSpan.FromDays(7)); // .WithJobExpirationTimeout(TimeSpan.FromDays(7));
var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔 // var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔
const int attempts = 3; // 重试次数 // const int attempts = 3; // 重试次数
config.UseFilter(new AutomaticRetryAttribute() { Attempts = 3, DelaysInSeconds = delaysInSeconds }); // config.UseFilter(new AutomaticRetryAttribute() { Attempts = 3, DelaysInSeconds = delaysInSeconds });
//config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7))); // //config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7)));
//config.UseFilter(new JobRetryLastFilter(attempts)); // //config.UseFilter(new JobRetryLastFilter(attempts));
}); // });
return service; // return service;
} // }
} }

7
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json

@ -1,6 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
//"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDb;" "Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDb;"
}, },
"Hangfire": { "Hangfire": {
@ -10,6 +9,7 @@
} }
}, },
"Redis": { "Redis": {
"IsEnabled": false,
"Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2" "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
}, },
"Jwt": { "Jwt": {
@ -26,11 +26,6 @@
"Port": 5672 "Port": 5672
} }
}, },
"ElasticSearch": {
"Host": "http://es.cn",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy"
},
"MiniProfiler": { "MiniProfiler": {
"Enabled": true, "Enabled": true,
"RouteBasePath": "/profiler" "RouteBasePath": "/profiler"

6
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json

@ -1,6 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
//"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;" "Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;"
}, },
"Hangfire": { "Hangfire": {
@ -26,11 +25,6 @@
"Port": 5672 "Port": 5672
} }
}, },
"ElasticSearch": {
"Host": "http://es.cn",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy"
},
"MiniProfiler": { "MiniProfiler": {
"Enabled": true, "Enabled": true,
"RouteBasePath": "/profiler" "RouteBasePath": "/profiler"

2
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json

@ -41,6 +41,6 @@
] ]
}, },
"App": { "App": {
"SelfUrl": "http://localhost:44315", "SelfUrl": "http://localhost:44315"
} }
} }

2
aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs

@ -4,8 +4,6 @@ namespace Lion.AbpPro.Demo;
public class DemoGetOutput : EntityDto<Guid> public class DemoGetOutput : EntityDto<Guid>
{ {
public Guid Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }

2
aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj

@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<RootNamespace>Lion.AbpPro</RootNamespace> <RootNamespace>Lion.AbpPro</RootNamespace>

2
aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj

@ -10,8 +10,6 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Localization\AbpPro\*.json" /> <EmbeddedResource Include="Localization\AbpPro\*.json" />
<Content Remove="Localization\AbpPro\*.json" /> <Content Remove="Localization\AbpPro\*.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj

@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<RootNamespace>Lion.AbpPro</RootNamespace> <RootNamespace>Lion.AbpPro</RootNamespace>

5
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs

@ -36,10 +36,7 @@ namespace Lion.AbpPro.EntityFrameworkCore
* See also HayoonKoreaDbContextFactory for EF Core tooling. * See also HayoonKoreaDbContextFactory for EF Core tooling.
* https://github.com/abpframework/abp/issues/21879 * https://github.com/abpframework/abp/issues/21879
* */ * */
options.UseNpgsql(builder => options.UseNpgsql();
{
builder.UseParameterizedCollectionMode(ParameterTranslationMode.MultipleParameters);
});
}); });
} }
} }

3
aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj

@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<RootNamespace>Lion.AbpPro</RootNamespace> <RootNamespace>Lion.AbpPro</RootNamespace>

3
aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj

@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<RootNamespace>Lion.AbpPro</RootNamespace> <RootNamespace>Lion.AbpPro</RootNamespace>

1
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/EntityFrameworkCore/MyModuleNameHttpApiHostMigrationsDbContextFactory.cs

@ -4,6 +4,7 @@ namespace MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore
{ {
public MyModuleNameHttpApiHostMigrationsDbContext CreateDbContext(string[] args) public MyModuleNameHttpApiHostMigrationsDbContext CreateDbContext(string[] args)
{ {
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
var configuration = BuildConfiguration(); var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<MyModuleNameHttpApiHostMigrationsDbContext>() var builder = new DbContextOptionsBuilder<MyModuleNameHttpApiHostMigrationsDbContext>()

5
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/GlobalUsings.cs

@ -5,7 +5,6 @@ global using System.Collections.Generic;
global using System.IO; global using System.IO;
global using System.Linq; global using System.Linq;
global using MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore; global using MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore;
global using Microsoft.AspNetCore.Authentication.JwtBearer;
global using Microsoft.AspNetCore.Builder; global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Cors; global using Microsoft.AspNetCore.Cors;
global using Microsoft.AspNetCore.DataProtection; global using Microsoft.AspNetCore.DataProtection;
@ -16,14 +15,12 @@ global using Microsoft.EntityFrameworkCore.Design;
global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Hosting;
global using Microsoft.OpenApi.Models;
global using Serilog; global using Serilog;
global using Serilog.Events; global using Serilog.Events;
global using StackExchange.Redis; global using StackExchange.Redis;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; global using Volo.Abp.AspNetCore.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.AuditLogging.EntityFrameworkCore; global using Volo.Abp.AuditLogging.EntityFrameworkCore;
global using Volo.Abp.Autofac; global using Volo.Abp.Autofac;

17
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Identity; using MyCompanyName.MyProjectName.MyModuleName;
using MyCompanyName.MyProjectName.MyModuleName;
#pragma warning disable CS0618 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete
@ -7,19 +6,7 @@ namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionExtensions public static class ServiceCollectionExtensions
{ {
/// <summary>
/// 注册Redis缓存
/// </summary>
public static IServiceCollection AddAbpProRedis(this IServiceCollection service)
{
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
var configuration = service.GetConfiguration();
var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration"));
service
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
return service;
}
/// <summary> /// <summary>
/// 配置虚拟文件系统 /// 配置虚拟文件系统
/// </summary> /// </summary>

12
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj

@ -7,20 +7,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog.AspNetCore"/>
<PackageReference Include="Serilog.Sinks.Async"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.Autofac"/>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy"/>
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql"/> <PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog"/> <PackageReference Include="Volo.Abp.AspNetCore.Serilog"/>
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore"/> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore"/>
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore"/> <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore"/>
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore"/> <PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore"/>
<PackageReference Include="Lion.AbpPro.AspNetCore"/> <ProjectReference Include="..\..\..\..\aspnet-core\frameworks\src\Lion.AbpPro.AspNetCore\Lion.AbpPro.AspNetCore.csproj"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -42,7 +34,7 @@
<PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets> <PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*.json"/> <Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*.json"/>
</ItemGroup> </ItemGroup>

4
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs

@ -7,9 +7,6 @@ namespace MyCompanyName.MyProjectName.MyModuleName;
typeof(MyModuleNameApplicationModule), typeof(MyModuleNameApplicationModule),
typeof(MyModuleNameEntityFrameworkCoreModule), typeof(MyModuleNameEntityFrameworkCoreModule),
typeof(MyModuleNameHttpApiModule), typeof(MyModuleNameHttpApiModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCorePostgreSqlModule), typeof(AbpEntityFrameworkCorePostgreSqlModule),
typeof(AbpAspNetCoreSerilogModule) typeof(AbpAspNetCoreSerilogModule)
)] )]
@ -23,7 +20,6 @@ public class MyModuleNameHttpApiHostModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddAbpProSwagger("MyProjectName") context.Services.AddAbpProSwagger("MyProjectName")
.AddAbpProRedis()
.AddAbpProCors() .AddAbpProCors()
.AddAbpProLocalization() .AddAbpProLocalization()
.AddAbpProExceptions() .AddAbpProExceptions()

7
templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json

@ -46,16 +46,9 @@
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=MyCompanyName.MyProjectName.MyModuleName;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" "Default": "Data Source=localhost;Port=3306;Database=MyCompanyName.MyProjectName.MyModuleName;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}, },
"Redis": {
"Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
},
"Swagger": { "Swagger": {
"Enabled": true "Enabled": true
}, },
"Cors": {
"Enabled": true,
"CorsOrigins": "http://localhost:4200,http://localhost:4201"
},
"MultiTenancy": { "MultiTenancy": {
"Enabled": true "Enabled": true
} }

BIN
templates/pro-module/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

2
templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Application/GlobalUsings.cs

@ -4,7 +4,6 @@ global using System.Collections.Generic;
global using System.Linq; global using System.Linq;
global using System.Threading; global using System.Threading;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using AutoMapper;
global using MyCompanyName.MyProjectName.MyModuleName.Localization; global using MyCompanyName.MyProjectName.MyModuleName.Localization;
global using MyCompanyName.MyProjectName.MyModuleName.Permissions; global using MyCompanyName.MyProjectName.MyModuleName.Permissions;
global using Microsoft.AspNetCore.Authorization; global using Microsoft.AspNetCore.Authorization;
@ -12,5 +11,4 @@ global using Microsoft.Extensions.DependencyInjection;
global using Volo.Abp.Application; global using Volo.Abp.Application;
global using Volo.Abp.Application.Dtos; global using Volo.Abp.Application.Dtos;
global using Volo.Abp.Application.Services; global using Volo.Abp.Application.Services;
global using Volo.Abp.AutoMapper;
global using Volo.Abp.Modularity; global using Volo.Abp.Modularity;

2
templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Domain/GlobalUsings.cs

@ -6,10 +6,8 @@ global using System.ComponentModel.DataAnnotations;
global using System.Linq; global using System.Linq;
global using System.Threading; global using System.Threading;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using AutoMapper;
global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.DependencyInjection;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AutoMapper;
global using Volo.Abp.Caching; global using Volo.Abp.Caching;
global using Volo.Abp.Data; global using Volo.Abp.Data;
global using Volo.Abp.DependencyInjection; global using Volo.Abp.DependencyInjection;

2
templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/GlobalUsings.cs

@ -5,6 +5,6 @@ global using System.Linq;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore; global using MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore;
global using Shouldly; global using Shouldly;
global using Volo.Abp.AutoMapper;
global using Volo.Abp.Modularity; global using Volo.Abp.Modularity;
global using Xunit; global using Xunit;

7
templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs

@ -9,12 +9,5 @@ namespace MyCompanyName.MyProjectName.MyModuleName
)] )]
public class MyModuleNameDomainTestModule : AbpModule public class MyModuleNameDomainTestModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<MyModuleNameDomainModule>(validate: true);
});
}
} }
} }

1
templates/pro-nuget/service/Directory.Build.targets

@ -51,7 +51,6 @@
<!-- CAP 分布式事务--> <!-- CAP 分布式事务-->
<PackageReference Update="DotNetCore.CAP" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.Dashboard" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.Dashboard" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.Mysql" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.PostgreSql" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.PostgreSql" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.RabbitMQ" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.RabbitMQ" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.InMemoryStorage" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.InMemoryStorage" Version="10.0.0"/>

7
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/GlobalUsings.cs

@ -27,8 +27,6 @@ global using Microsoft.Extensions.Localization;
global using Microsoft.Extensions.Logging; global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions; global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options; global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi.Models;
global using Serilog; global using Serilog;
global using StackExchange.Redis; global using StackExchange.Redis;
global using Swagger; global using Swagger;
@ -36,18 +34,19 @@ global using Swashbuckle.AspNetCore.SwaggerUI;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.Account.Web; global using Volo.Abp.Account.Web;
global using Volo.Abp.AspNetCore.Auditing; global using Volo.Abp.AspNetCore.Auditing;
global using Volo.Abp.AspNetCore.Authentication.JwtBearer;
global using Volo.Abp.AspNetCore.ExceptionHandling; global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; global using Volo.Abp.AspNetCore.MultiTenancy;
global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AspNetCore.Serilog;
global using Volo.Abp.Auditing; global using Volo.Abp.Auditing;
global using Volo.Abp.Authorization; global using Volo.Abp.Authorization;
global using Volo.Abp.BackgroundJobs; global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.BlobStoring.FileSystem;
global using Volo.Abp.Caching; global using Volo.Abp.Caching;
global using Volo.Abp.Caching.StackExchangeRedis; global using Volo.Abp.Caching.StackExchangeRedis;
global using Volo.Abp.DependencyInjection; global using Volo.Abp.DependencyInjection;
global using Volo.Abp.DistributedLocking;
global using Volo.Abp.Domain.Entities; global using Volo.Abp.Domain.Entities;
global using Volo.Abp.ExceptionHandling; global using Volo.Abp.ExceptionHandling;
global using Volo.Abp.Http; global using Volo.Abp.Http;

109
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

@ -1,5 +1,7 @@
using Medallion.Threading; using Medallion.Threading;
using Medallion.Threading.Redis; using Medallion.Threading.Redis;
using Microsoft.AspNetCore.SignalR.StackExchangeRedis;
using Volo.Abp.BlobStoring;
#pragma warning disable CS0618 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete
@ -10,14 +12,23 @@ public static class ServiceCollectionExtensions
/// <summary> /// <summary>
/// 注册Redis缓存 /// 注册Redis缓存
/// </summary> /// </summary>
public static IServiceCollection AddAbpProRedis(this IServiceCollection service) public static IServiceCollection AddAbpProRedis(this IServiceCollection service, Action<AbpDistributedCacheOptions> configureOptions = null)
{ {
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
var configuration = service.GetConfiguration(); var configuration = service.GetConfiguration();
var redisEnabled = configuration["Redis:IsEnabled"];
if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service;
if (configureOptions != null)
{
service.Configure(configureOptions);
}
else
{
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
}
var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration")); var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration"));
service service.AddDataProtection().PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
return service; return service;
} }
@ -27,6 +38,9 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service) public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service)
{ {
var configuration = service.GetConfiguration(); var configuration = service.GetConfiguration();
var redisEnabled = configuration["Redis:IsEnabled"];
if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service;
var connectionString = configuration.GetValue<string>("Redis:Configuration"); var connectionString = configuration.GetValue<string>("Redis:Configuration");
service.AddSingleton<IDistributedLockProvider>(sp => service.AddSingleton<IDistributedLockProvider>(sp =>
{ {
@ -48,12 +62,87 @@ public static class ServiceCollectionExtensions
/// <summary> /// <summary>
/// 注册SignalR /// 注册SignalR
/// </summary> /// </summary>
public static IServiceCollection AddAbpProSignalR(this IServiceCollection service) public static IServiceCollection AddAbpProSignalR(this IServiceCollection service, Action<RedisOptions> redisOptions = null)
{ {
service var configuration = service.GetConfiguration();
.AddSignalR() var redisEnabled = configuration["Redis:IsEnabled"];
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"), if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled))
options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); {
if (redisOptions != null)
{
service
.AddSignalR()
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"), redisOptions);
}
else
{
service
.AddSignalR()
.AddStackExchangeRedis(service.GetConfiguration().GetValue<string>("Redis:Configuration"),
options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; });
}
}
else
{
service.AddSignalR();
}
return service; return service;
} }
/// <summary>
/// 注册基于FileSystem的blob设置
/// </summary>
public static IServiceCollection AddAbpProBlobStorageFileSystem(this IServiceCollection service)
{
service.Configure<AbpBlobStoringOptions>(options => { options.Containers.ConfigureDefault(container => { container.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\\my-files"; }); }); });
return service;
}
// /// <summary>
// /// 注册cap
// /// </summary>
// public static IServiceCollection AddAbpProCap(this IServiceCollection service)
// {
// var configuration = service.GetConfiguration();
// service.AddAbpCap(capOptions =>
// {
// capOptions.SetCapDbConnectionString(configuration["ConnectionStrings:Default"]);
// capOptions.UseEntityFramework<AbpProDbContext>();
// capOptions.UseRabbitMQ(option =>
// {
// option.HostName = configuration.GetValue<string>("Cap:RabbitMq:HostName");
// option.UserName = configuration.GetValue<string>("Cap:RabbitMq:UserName");
// option.Password = configuration.GetValue<string>("Cap:RabbitMq:Password");
// option.Port = configuration.GetValue<int>("Cap:RabbitMq:Port");
// });
// capOptions.UseDashboard(options => { options.AuthorizationPolicy = AbpProCapPermissions.CapManagement.Cap; });
// });
// return service;
// }
// /// <summary>
// /// 注册hangfire
// /// </summary>
// public static IServiceCollection AddAbpProHangfire(this IServiceCollection service)
// {
// var redisStorageOptions = new RedisStorageOptions()
// {
// Db = service.GetConfiguration().GetValue<int>("Hangfire:Redis:DB")
// };
//
// service.Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = true; });
//
// service.AddHangfire(config =>
// {
// config.UseRedisStorage(service.GetConfiguration().GetValue<string>("Hangfire:Redis:Host"), redisStorageOptions)
// .WithJobExpirationTimeout(TimeSpan.FromDays(7));
// var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔
// const int attempts = 3; // 重试次数
// config.UseFilter(new AutomaticRetryAttribute() { Attempts = 3, DelaysInSeconds = delaysInSeconds });
// //config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7)));
// //config.UseFilter(new JobRetryLastFilter(attempts));
// });
// return service;
// }
} }

7
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj

@ -10,19 +10,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Account.Web"/> <PackageReference Include="Volo.Abp.Account.Web"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy"/>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis"/>
<PackageReference Include="Volo.Abp.AspNetCore.Serilog"/> <PackageReference Include="Volo.Abp.AspNetCore.Serilog"/>
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer"/>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic"/>
<PackageReference Include="Volo.Abp.DistributedLocking"/> <PackageReference Include="Volo.Abp.DistributedLocking"/>
<PackageReference Include="Volo.Abp.BlobStoring.FileSystem"/> <PackageReference Include="Volo.Abp.BlobStoring.FileSystem"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/> <PackageReference Include="DotNetCore.CAP.PostgreSql"/>
<PackageReference Include="DotNetCore.CAP.MySql"/>
<PackageReference Include="DotNetCore.CAP.RabbitMQ"/> <PackageReference Include="DotNetCore.CAP.RabbitMQ"/>
<PackageReference Include="DotNetCore.CAP.Dashboard"/> <PackageReference Include="DotNetCore.CAP.Dashboard"/>
<PackageReference Include="DistributedLock.Redis"/> <PackageReference Include="DistributedLock.Redis"/>

111
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs

@ -1,67 +1,56 @@
namespace MyCompanyName.MyProjectName namespace MyCompanyName.MyProjectName;
[DependsOn(
typeof(MyProjectNameHttpApiModule),
typeof(AbpProAspNetCoreModule),
typeof(MyProjectNameEntityFrameworkCoreModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule),
typeof(MyProjectNameApplicationModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpBlobStoringFileSystemModule)
)]
public class MyProjectNameHttpApiHostModule : AbpModule
{ {
[DependsOn( public override void ConfigureServices(ServiceConfigurationContext context)
typeof(MyProjectNameHttpApiModule),
typeof(AbpProAspNetCoreModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(MyProjectNameEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule),
typeof(MyProjectNameApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule)
)]
public class MyProjectNameHttpApiHostModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) context.Services
{ .AddAbpProAuditLog()
context.Services .AddAbpProJwtBearer()
.AddAbpProAuditLog() .AddAbpProMultiTenancy()
.AddAbpProAuthentication() .AddAbpProRedis()
.AddAbpProMultiTenancy() .AddAbpProMiniProfiler()
.AddAbpProRedis() .AddAbpProCors()
.AddAbpProRedisDistributedLocking() .AddAbpProAntiForgery()
.AddAbpProMiniProfiler() .AddAbpProIdentity()
.AddAbpProCors() .AddAbpProSignalR()
.AddAbpProAntiForgery() .AddAbpProHealthChecks()
.AddAbpProIdentity() .AddAbpProTenantResolvers()
.AddAbpProSignalR() .AddAbpProLocalization()
.AddAbpProHealthChecks() .AddAbpProExceptions()
.AddAbpProTenantResolvers() .AddAbpProSwagger("AbpPro");
.AddAbpProLocalization() }
.AddAbpProExceptions()
.AddAbpProSwagger("AbpPro");
}
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseAbpProRequestLocalization();
app.UseCorrelationId();
app.MapAbpStaticAssets();
app.UseAbpProMiniProfiler();
app.UseRouting();
app.UseAbpProCors();
app.UseAuthentication();
app.UseAbpProMultiTenancy();
app.UseAuthorization();
app.UseAbpProSwaggerUI("/swagger/AbpPro/swagger.json","AbpPro");
app.UseAbpProAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints =>
{ {
var app = context.GetApplicationBuilder(); endpoints.MapHealthChecks("/health");
app.UseAbpProRequestLocalization(); });
app.UseCorrelationId(); app.UseAbpProConsul();
app.MapAbpStaticAssets();
app.UseAbpProMiniProfiler();
app.UseRouting();
app.UseAbpProCors();
app.UseAuthentication();
app.UseAbpProMultiTenancy();
app.UseAuthorization();
app.UseAbpProSwaggerUI("/swagger/AbpPro/swagger.json","AbpPro");
app.UseAbpProAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
// {
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
// IgnoreAntiforgeryToken = true
// });
});
app.UseAbpProConsul();
}
} }
} }

68
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.Development.json

@ -0,0 +1,68 @@
{
"ConnectionStrings": {
//"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDb;"
},
"Hangfire": {
"Redis": {
"Host": "localhost:6379,password=1q2w3E*",
"DB": "2"
}
},
"Redis": {
"IsEnabled": false,
"Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
},
"Jwt": {
"Audience": "Lion.AbpPro",
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
"Issuer": "Lion.AbpPro",
"ExpirationTime": 2
},
"Cap": {
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "1q2w3E*",
"Port": 5672
}
},
"ElasticSearch": {
"Host": "http://es.cn",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy"
},
"MiniProfiler": {
"Enabled": true,
"RouteBasePath": "/profiler"
},
"Swagger": {
"Enabled": true
},
"Audit": {
"Enabled": true,
"ApplicationName": "Lion.AbpPro"
},
"Cors": {
"Enabled": true,
"CorsOrigins": "http://localhost:4200,http://localhost:4201"
},
"Consul": {
"Enabled": false,
"ServiceUrl": "http://localhost:8500",
"ClientName": "Lion.AbpPro.Api",
"ClientAddress": "localhost",
"ClientPort": 44315,
"HealthUrl": "http://localhost:44315/health",
"DeregisterCriticalServiceAfter": 30,
"Interval": 30,
"Timeout": 30
},
"MultiTenancy": {
"Enabled": true
},
"Preheat": {
"Enabled": true,
"RequestUrl": "http://localhost:44315/api/abp/application-configuration?IncludeLocalizationResources=false"
}
}

2
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/GlobalUsings.cs

@ -4,6 +4,7 @@ global using System;
global using System.Collections.Generic; global using System.Collections.Generic;
global using System.Linq; global using System.Linq;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using Lion.AbpPro.AspNetCore;
global using Microsoft.AspNetCore.Builder; global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Cors; global using Microsoft.AspNetCore.Cors;
global using Microsoft.AspNetCore.Hosting; global using Microsoft.AspNetCore.Hosting;
@ -15,4 +16,5 @@ global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging; global using Microsoft.Extensions.Logging;
global using Ocelot.Middleware; global using Ocelot.Middleware;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.Modularity; global using Volo.Abp.Modularity;

6
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs

@ -1,10 +1,6 @@
using Lion.AbpPro.AspNetCore; namespace MyCompanyName.MyProjectName.WebGateway;
using Volo.Abp.AspNetCore.Mvc;
namespace Lion.AbpPro.WebGateway;
[DependsOn( [DependsOn(
typeof(AbpAspNetCoreMvcModule),
typeof(AbpProAspNetCoreModule))] typeof(AbpProAspNetCoreModule))]
public class MyProjectNameWebGatewayModule : AbpModule public class MyProjectNameWebGatewayModule : AbpModule
{ {

2
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs

@ -1,5 +1,3 @@
using Lion.AbpPro.WebGateway;
namespace MyCompanyName.MyProjectName.WebGateway namespace MyCompanyName.MyProjectName.WebGateway
{ {
public class Program public class Program

BIN
templates/pro-nuget/service/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

5
templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs

@ -32,10 +32,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
}); });
Configure<AbpDbContextOptions>(options => Configure<AbpDbContextOptions>(options =>
{ {
options.UseNpgsql(builder => options.UseNpgsql();
{
builder.TranslateParameterizedCollectionsToConstants();
});
}); });
} }
} }

Loading…
Cancel
Save