diff --git a/aspnet-core/Directory.Build.Volo.targets b/aspnet-core/Directory.Build.Volo.targets index a3b3b6c5..c14ecc35 100644 --- a/aspnet-core/Directory.Build.Volo.targets +++ b/aspnet-core/Directory.Build.Volo.targets @@ -27,11 +27,9 @@ - - diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj index 2fe0f5d3..d25d745f 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion.AbpPro.AspNetCore.csproj @@ -19,6 +19,7 @@ + diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs index 4114d291..563574ba 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs @@ -1,7 +1,14 @@ using Lion.AbpPro.AspNetCore.Options; +using Volo.Abp.AspNetCore.MultiTenancy; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; namespace Lion.AbpPro.AspNetCore; +[DependsOn( + typeof(AbpAspNetCoreMultiTenancyModule), + typeof(AbpAspNetCoreMvcUiBasicThemeModule) + ) +] public class AbpProAspNetCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index 8579c3e2..39334b2f 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs @@ -229,7 +229,7 @@ public static class ServiceCollectionExtensions /// /// 配置JWT /// - public static IServiceCollection AddAbpProAuthentication(this IServiceCollection service) + public static IServiceCollection AddAbpProJwtBearer(this IServiceCollection service) { var jwtOptions = service.BuildServiceProvider().GetRequiredService>().Value; var cookieOptions = service.BuildServiceProvider().GetRequiredService>().Value; diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs index c4cfdfb6..4a273acb 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs @@ -15,6 +15,8 @@ public static class ReplacePackageReferenceExtensions "") .Replace("", "") + .Replace("", + "") ; } diff --git a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/BasicManagementHttpApiHostModule.cs b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/BasicManagementHttpApiHostModule.cs index fd382aef..505281b4 100644 --- a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/BasicManagementHttpApiHostModule.cs +++ b/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; namespace Lion.AbpPro.BasicManagement; @@ -6,7 +7,7 @@ namespace Lion.AbpPro.BasicManagement; typeof(BasicManagementApplicationModule), typeof(BasicManagementEntityFrameworkCoreModule), typeof(BasicManagementHttpApiModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpAutofacModule), typeof(AbpCachingStackExchangeRedisModule), typeof(AbpEntityFrameworkCorePostgreSqlModule), @@ -26,7 +27,7 @@ public class BasicManagementHttpApiHostModule : AbpModule { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() diff --git a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/GlobalUsings.cs b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/GlobalUsings.cs index 243e1542..e10b8422 100644 --- a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/GlobalUsings.cs +++ b/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 Volo.Abp; global using Volo.Abp.AspNetCore.ExceptionHandling; -global using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; + global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.Autofac; global using Volo.Abp.Caching; diff --git a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj index 1276cbd2..3da1bdec 100644 --- a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj @@ -9,14 +9,8 @@ - - - - - - diff --git a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs b/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs index 3e58a4be..e15e038b 100644 --- a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs +++ b/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/DataDictionaryManagementHttpApiHostModule.cs @@ -1,6 +1,7 @@ using Lion.AbpPro.AspNetCore; using Microsoft.OpenApi; using Swashbuckle.AspNetCore.SwaggerUI; +using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.EntityFrameworkCore.PostgreSql; namespace Lion.AbpPro.DataDictionaryManagement @@ -9,7 +10,7 @@ namespace Lion.AbpPro.DataDictionaryManagement typeof(DataDictionaryManagementApplicationModule), typeof(DataDictionaryManagementEntityFrameworkCoreModule), typeof(DataDictionaryManagementHttpApiModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpAutofacModule), typeof(AbpCachingStackExchangeRedisModule), typeof(AbpEntityFrameworkCorePostgreSqlModule), @@ -30,7 +31,7 @@ namespace Lion.AbpPro.DataDictionaryManagement { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() diff --git a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/GlobalUsings.cs b/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/GlobalUsings.cs index 554dbfec..2d9ea0a2 100644 --- a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/GlobalUsings.cs +++ b/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 Volo.Abp; 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.AuditLogging.EntityFrameworkCore; global using Volo.Abp.Autofac; diff --git a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj b/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj index fb4ad5d7..f8bce27e 100644 --- a/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/DataDictionaryManagement/host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host/Lion.AbpPro.DataDictionaryManagement.HttpApi.Host.csproj @@ -9,13 +9,7 @@ - - - - - - diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs index 76aad57f..bde9d523 100644 --- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs +++ b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/FileManagementHttpApiHostModule.cs @@ -25,7 +25,7 @@ public class FileManagementHttpApiHostModule : AbpModule { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj index f2210525..d948536c 100644 --- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj @@ -10,25 +10,10 @@ - - - - - - - - - - - - - - - diff --git a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/GlobalUsings.cs b/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/GlobalUsings.cs index 7f8e9178..76bba72b 100644 --- a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/GlobalUsings.cs +++ b/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 Volo.Abp; 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.AuditLogging.EntityFrameworkCore; global using Volo.Abp.Autofac; diff --git a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs b/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs index 97450791..e322ac95 100644 --- a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs +++ b/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/LanguageManagementHttpApiHostModule.cs @@ -1,5 +1,6 @@ using Lion.AbpPro.AspNetCore; using Swashbuckle.AspNetCore.SwaggerUI; +using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.EntityFrameworkCore.PostgreSql; namespace Lion.AbpPro.LanguageManagement @@ -8,7 +9,7 @@ namespace Lion.AbpPro.LanguageManagement typeof(LanguageManagementApplicationModule), typeof(LanguageManagementEntityFrameworkCoreModule), typeof(LanguageManagementHttpApiModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpAutofacModule), typeof(AbpCachingStackExchangeRedisModule), typeof(AbpEntityFrameworkCorePostgreSqlModule), @@ -30,7 +31,7 @@ namespace Lion.AbpPro.LanguageManagement { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() diff --git a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj b/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj index e438c878..ddb6845a 100644 --- a/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Lion.AbpPro.LanguageManagement.HttpApi.Host.csproj @@ -10,13 +10,7 @@ - - - - - - diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj index 08ee7669..835ca8cc 100644 --- a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj @@ -9,24 +9,10 @@ - - - - - - - - - - - - - - diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs index 232ca17d..595cd702 100644 --- a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs +++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/NotificationManagementHttpApiHostModule.cs @@ -26,7 +26,7 @@ public class NotificationManagementHttpApiHostModule : AbpModule { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs index 513132d6..a2a3c78e 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs @@ -3,53 +3,35 @@ namespace Lion.AbpPro; [DependsOn( typeof(AbpProHttpApiModule), typeof(AbpProAspNetCoreModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpProEntityFrameworkCoreModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpAccountWebModule), typeof(AbpProApplicationModule), - // typeof(AbpProCapModule), - // typeof(AbpProCapEntityFrameworkCoreModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpDistributedLockingModule), typeof(AbpBlobStoringFileSystemModule), typeof(AbpProStarterModule) - //typeof(AbpBackgroundJobsHangfireModule) )] public partial class AbpProHttpApiHostModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - // 动态配置 - // PreConfigure(options => - // { - // options.ConventionalControllers.Create(typeof(AbpProApplicationModule).Assembly); - // }); - } - + public override void ConfigureServices(ServiceConfigurationContext context) { context.Services .AddAbpProAuditLog() - .AddAbpProAuthentication() + .AddAbpProJwtBearer() .AddAbpProMultiTenancy() .AddAbpProRedis() - .AddAbpProRedisDistributedLocking() .AddAbpProMiniProfiler() .AddAbpProCors() .AddAbpProAntiForgery() .AddAbpProIdentity() - .AddAbpProBlobStorage() + .AddAbpProBlobStorageFileSystem() .AddAbpProSignalR() .AddAbpProHealthChecks() .AddAbpProTenantResolvers() .AddAbpProLocalization() .AddAbpProExceptions() - .AddAbpProConsul() .AddAbpProSwagger("AbpPro"); - context.Services.AddAlwaysAllowAuthorization(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -71,13 +53,6 @@ public partial class AbpProHttpApiHostModule : AbpModule app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); - - // endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions() - // { - // Authorization = new[] { new CustomHangfireAuthorizeFilter() }, - // IgnoreAntiforgeryToken = true - // }); }); - app.UseAbpProConsul(); } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs index 42436028..2e455069 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs +++ b/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 Consul; 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.Options; global using Lion.AbpPro.CAP; @@ -52,12 +46,11 @@ global using Swashbuckle.AspNetCore.SwaggerUI; global using Volo.Abp; global using Volo.Abp.Account.Web; global using Volo.Abp.AspNetCore.Auditing; -global using Volo.Abp.AspNetCore.Authentication.JwtBearer; global using Volo.Abp.AspNetCore.ExceptionHandling; global using Volo.Abp.AspNetCore.MultiTenancy; global using Volo.Abp.AspNetCore.Mvc; 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.Serilog; global using Volo.Abp.Auditing; diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj index 5bfcc26a..6e45f72f 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj @@ -7,25 +7,19 @@ Lion.AbpPro-4681b4fd-151f-4221-84a4-929d86723e4c - - - - - - diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index 1727b219..7156dd3b 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/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 @@ -9,14 +10,23 @@ public static class ServiceCollectionExtensions /// /// 注册Redis缓存 /// - public static IServiceCollection AddAbpProRedis(this IServiceCollection service) + public static IServiceCollection AddAbpProRedis(this IServiceCollection service, Action configureOptions = null) { - service.Configure(options => { options.KeyPrefix = "AbpPro:"; }); 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(options => { options.KeyPrefix = "AbpPro:"; }); + } + var redis = ConnectionMultiplexer.Connect(configuration.GetValue("Redis:Configuration")); - service - .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys"); + service.AddDataProtection().PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys"); return service; } @@ -26,6 +36,9 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service) { var configuration = service.GetConfiguration(); + var redisEnabled = configuration["Redis:IsEnabled"]; + if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service; + var connectionString = configuration.GetValue("Redis:Configuration"); service.AddSingleton(sp => { @@ -47,19 +60,38 @@ public static class ServiceCollectionExtensions /// /// 注册SignalR /// - public static IServiceCollection AddAbpProSignalR(this IServiceCollection service) + public static IServiceCollection AddAbpProSignalR(this IServiceCollection service, Action redisOptions = null) { - service - .AddSignalR() - .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), - options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); + var configuration = service.GetConfiguration(); + var redisEnabled = configuration["Redis:IsEnabled"]; + if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) + { + if (redisOptions != null) + { + service + .AddSignalR() + .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), redisOptions); + } + else + { + service + .AddSignalR() + .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), + options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); + } + } + else + { + service.AddSignalR(); + } + return service; } /// - /// 注册blob设置 + /// 注册基于FileSystem的blob设置 /// - public static IServiceCollection AddAbpProBlobStorage(this IServiceCollection service) + public static IServiceCollection AddAbpProBlobStorageFileSystem(this IServiceCollection service) { service.Configure(options => { options.Containers.ConfigureDefault(container => { container.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\\my-files"; }); }); }); return service; @@ -87,28 +119,28 @@ public static class ServiceCollectionExtensions return service; } - /// - /// 注册hangfire - /// - public static IServiceCollection AddAbpProHangfire(this IServiceCollection service) - { - var redisStorageOptions = new RedisStorageOptions() - { - Db = service.GetConfiguration().GetValue("Hangfire:Redis:DB") - }; - - service.Configure(options => { options.IsJobExecutionEnabled = true; }); - - service.AddHangfire(config => - { - config.UseRedisStorage(service.GetConfiguration().GetValue("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; - } + // /// + // /// 注册hangfire + // /// + // public static IServiceCollection AddAbpProHangfire(this IServiceCollection service) + // { + // var redisStorageOptions = new RedisStorageOptions() + // { + // Db = service.GetConfiguration().GetValue("Hangfire:Redis:DB") + // }; + // + // service.Configure(options => { options.IsJobExecutionEnabled = true; }); + // + // service.AddHangfire(config => + // { + // config.UseRedisStorage(service.GetConfiguration().GetValue("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; + // } } \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json index c60f2025..e255721d 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json @@ -1,6 +1,5 @@ { "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": { @@ -10,6 +9,7 @@ } }, "Redis": { + "IsEnabled": false, "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2" }, "Jwt": { @@ -26,11 +26,6 @@ "Port": 5672 } }, - "ElasticSearch": { - "Host": "http://es.cn", - "UserName": "elastic", - "Password": "aVVhjQ95RP7nbwNy" - }, "MiniProfiler": { "Enabled": true, "RouteBasePath": "/profiler" diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json index cae2d1b0..c26aec18 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json @@ -1,6 +1,5 @@ { "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;" }, "Hangfire": { @@ -26,11 +25,6 @@ "Port": 5672 } }, - "ElasticSearch": { - "Host": "http://es.cn", - "UserName": "elastic", - "Password": "aVVhjQ95RP7nbwNy" - }, "MiniProfiler": { "Enabled": true, "RouteBasePath": "/profiler" diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json index 78385035..080b2453 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json @@ -41,6 +41,6 @@ ] }, "App": { - "SelfUrl": "http://localhost:44315", + "SelfUrl": "http://localhost:44315" } } \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs index caac6fca..292e68d0 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs +++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Demo/DemoGetOutput.cs @@ -4,8 +4,6 @@ namespace Lion.AbpPro.Demo; public class DemoGetOutput : EntityDto { - public Guid Id { get; set; } - public string Name { get; set; } public string Description { get; set; } diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj b/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj index d43113b1..36421d82 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj @@ -1,6 +1,4 @@ - - net10.0 Lion.AbpPro diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj index d6fc551d..c450d151 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj @@ -10,8 +10,6 @@ - - diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj index 244c4d44..f41d77e0 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj @@ -1,7 +1,5 @@ - - net10.0 Lion.AbpPro diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs index 4276fff9..3d464a57 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs +++ b/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. * https://github.com/abpframework/abp/issues/21879 * */ - options.UseNpgsql(builder => - { - builder.UseParameterizedCollectionMode(ParameterTranslationMode.MultipleParameters); - }); + options.UseNpgsql(); }); } } diff --git a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj index 4fffeed1..4d2106c0 100644 --- a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj @@ -1,7 +1,4 @@ - - - net10.0 Lion.AbpPro diff --git a/aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj b/aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj index 901a4fe8..4d9047ea 100644 --- a/aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj @@ -1,7 +1,4 @@ - - - net10.0 Lion.AbpPro diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/EntityFrameworkCore/MyModuleNameHttpApiHostMigrationsDbContextFactory.cs b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/EntityFrameworkCore/MyModuleNameHttpApiHostMigrationsDbContextFactory.cs index c4316b69..74029e06 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/EntityFrameworkCore/MyModuleNameHttpApiHostMigrationsDbContextFactory.cs +++ b/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) { + AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); var configuration = BuildConfiguration(); var builder = new DbContextOptionsBuilder() diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/GlobalUsings.cs b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/GlobalUsings.cs index f0a8c82c..78576729 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/GlobalUsings.cs +++ b/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.Linq; global using MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore; -global using Microsoft.AspNetCore.Authentication.JwtBearer; global using Microsoft.AspNetCore.Builder; global using Microsoft.AspNetCore.Cors; global using Microsoft.AspNetCore.DataProtection; @@ -16,14 +15,12 @@ global using Microsoft.EntityFrameworkCore.Design; global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.Hosting; -global using Microsoft.OpenApi.Models; global using Serilog; global using Serilog.Events; global using StackExchange.Redis; global using Volo.Abp; 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.MultiTenancy; global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.AuditLogging.EntityFrameworkCore; global using Volo.Abp.Autofac; diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index ce13bcf3..8fac481f 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/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 @@ -7,19 +6,7 @@ namespace Microsoft.Extensions.DependencyInjection; public static class ServiceCollectionExtensions { - /// - /// 注册Redis缓存 - /// - public static IServiceCollection AddAbpProRedis(this IServiceCollection service) - { - service.Configure(options => { options.KeyPrefix = "AbpPro:"; }); - var configuration = service.GetConfiguration(); - var redis = ConnectionMultiplexer.Connect(configuration.GetValue("Redis:Configuration")); - service - .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys"); - return service; - } + /// /// 配置虚拟文件系统 /// diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj index 9297222a..f1874e3d 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj +++ b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host.csproj @@ -7,20 +7,12 @@ - - - - - - - - - + @@ -42,7 +34,7 @@ compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native - + diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs index 077c96b7..0fc6fcb1 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs +++ b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/MyModuleNameHttpApiHostModule.cs @@ -7,9 +7,6 @@ namespace MyCompanyName.MyProjectName.MyModuleName; typeof(MyModuleNameApplicationModule), typeof(MyModuleNameEntityFrameworkCoreModule), typeof(MyModuleNameHttpApiModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AbpAutofacModule), - typeof(AbpCachingStackExchangeRedisModule), typeof(AbpEntityFrameworkCorePostgreSqlModule), typeof(AbpAspNetCoreSerilogModule) )] @@ -23,7 +20,6 @@ public class MyModuleNameHttpApiHostModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAbpProSwagger("MyProjectName") - .AddAbpProRedis() .AddAbpProCors() .AddAbpProLocalization() .AddAbpProExceptions() diff --git a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json index e5c8fcea..b2d2b5ff 100644 --- a/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json +++ b/templates/pro-module/host/MyCompanyName.MyProjectName.MyModuleName.HttpApi.Host/appsettings.json @@ -46,16 +46,9 @@ "ConnectionStrings": { "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": { "Enabled": true }, - "Cors": { - "Enabled": true, - "CorsOrigins": "http://localhost:4200,http://localhost:4201" - }, "MultiTenancy": { "Enabled": true } diff --git a/templates/pro-module/icon.png b/templates/pro-module/icon.png new file mode 100644 index 00000000..c556047e Binary files /dev/null and b/templates/pro-module/icon.png differ diff --git a/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Application/GlobalUsings.cs b/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Application/GlobalUsings.cs index f57697ce..f6049d66 100644 --- a/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Application/GlobalUsings.cs +++ b/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.Threading; global using System.Threading.Tasks; -global using AutoMapper; global using MyCompanyName.MyProjectName.MyModuleName.Localization; global using MyCompanyName.MyProjectName.MyModuleName.Permissions; global using Microsoft.AspNetCore.Authorization; @@ -12,5 +11,4 @@ global using Microsoft.Extensions.DependencyInjection; global using Volo.Abp.Application; global using Volo.Abp.Application.Dtos; global using Volo.Abp.Application.Services; -global using Volo.Abp.AutoMapper; global using Volo.Abp.Modularity; \ No newline at end of file diff --git a/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Domain/GlobalUsings.cs b/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Domain/GlobalUsings.cs index 21ab70a4..83892971 100644 --- a/templates/pro-module/src/MyCompanyName.MyProjectName.MyModuleName.Domain/GlobalUsings.cs +++ b/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.Threading; global using System.Threading.Tasks; -global using AutoMapper; global using Microsoft.Extensions.DependencyInjection; global using Volo.Abp; -global using Volo.Abp.AutoMapper; global using Volo.Abp.Caching; global using Volo.Abp.Data; global using Volo.Abp.DependencyInjection; diff --git a/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/GlobalUsings.cs b/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/GlobalUsings.cs index 63aa82d0..d4ea7f34 100644 --- a/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/GlobalUsings.cs +++ b/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 MyCompanyName.MyProjectName.MyModuleName.EntityFrameworkCore; global using Shouldly; -global using Volo.Abp.AutoMapper; + global using Volo.Abp.Modularity; global using Xunit; \ No newline at end of file diff --git a/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs b/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs index 4231385f..0c28238c 100644 --- a/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs +++ b/templates/pro-module/test/MyCompanyName.MyProjectName.MyModuleName.Domain.Tests/MyModuleNameDomainTestModule.cs @@ -9,12 +9,5 @@ namespace MyCompanyName.MyProjectName.MyModuleName )] public class MyModuleNameDomainTestModule : AbpModule { - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.AddMaps(validate: true); - }); - } } } diff --git a/templates/pro-nuget/service/Directory.Build.targets b/templates/pro-nuget/service/Directory.Build.targets index 01ed107d..d58f75e7 100644 --- a/templates/pro-nuget/service/Directory.Build.targets +++ b/templates/pro-nuget/service/Directory.Build.targets @@ -51,7 +51,6 @@ - diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/GlobalUsings.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/GlobalUsings.cs index 4785e870..0589f7ef 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/GlobalUsings.cs +++ b/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.Abstractions; global using Microsoft.Extensions.Options; -global using Microsoft.IdentityModel.Tokens; -global using Microsoft.OpenApi.Models; global using Serilog; global using StackExchange.Redis; global using Swagger; @@ -36,18 +34,19 @@ global using Swashbuckle.AspNetCore.SwaggerUI; global using Volo.Abp; global using Volo.Abp.Account.Web; global using Volo.Abp.AspNetCore.Auditing; -global using Volo.Abp.AspNetCore.Authentication.JwtBearer; global using Volo.Abp.AspNetCore.ExceptionHandling; 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.Serilog; global using Volo.Abp.Auditing; global using Volo.Abp.Authorization; global using Volo.Abp.BackgroundJobs; +global using Volo.Abp.BlobStoring.FileSystem; global using Volo.Abp.Caching; global using Volo.Abp.Caching.StackExchangeRedis; global using Volo.Abp.DependencyInjection; +global using Volo.Abp.DistributedLocking; global using Volo.Abp.Domain.Entities; global using Volo.Abp.ExceptionHandling; global using Volo.Abp.Http; diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index c8ad0d16..0f5a0fba 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,5 +1,7 @@ using Medallion.Threading; using Medallion.Threading.Redis; +using Microsoft.AspNetCore.SignalR.StackExchangeRedis; +using Volo.Abp.BlobStoring; #pragma warning disable CS0618 // Type or member is obsolete @@ -10,14 +12,23 @@ public static class ServiceCollectionExtensions /// /// 注册Redis缓存 /// - public static IServiceCollection AddAbpProRedis(this IServiceCollection service) + public static IServiceCollection AddAbpProRedis(this IServiceCollection service, Action configureOptions = null) { - service.Configure(options => { options.KeyPrefix = "AbpPro:"; }); 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(options => { options.KeyPrefix = "AbpPro:"; }); + } + var redis = ConnectionMultiplexer.Connect(configuration.GetValue("Redis:Configuration")); - service - .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys"); + service.AddDataProtection().PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys"); return service; } @@ -27,6 +38,9 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service) { var configuration = service.GetConfiguration(); + var redisEnabled = configuration["Redis:IsEnabled"]; + if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service; + var connectionString = configuration.GetValue("Redis:Configuration"); service.AddSingleton(sp => { @@ -48,12 +62,87 @@ public static class ServiceCollectionExtensions /// /// 注册SignalR /// - public static IServiceCollection AddAbpProSignalR(this IServiceCollection service) + public static IServiceCollection AddAbpProSignalR(this IServiceCollection service, Action redisOptions = null) { - service - .AddSignalR() - .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), - options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); + var configuration = service.GetConfiguration(); + var redisEnabled = configuration["Redis:IsEnabled"]; + if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) + { + if (redisOptions != null) + { + service + .AddSignalR() + .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), redisOptions); + } + else + { + service + .AddSignalR() + .AddStackExchangeRedis(service.GetConfiguration().GetValue("Redis:Configuration"), + options => { options.Configuration.ChannelPrefix = "Lion.AbpPro"; }); + } + } + else + { + service.AddSignalR(); + } + return service; } + + /// + /// 注册基于FileSystem的blob设置 + /// + public static IServiceCollection AddAbpProBlobStorageFileSystem(this IServiceCollection service) + { + service.Configure(options => { options.Containers.ConfigureDefault(container => { container.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\\my-files"; }); }); }); + return service; + } + + // /// + // /// 注册cap + // /// + // public static IServiceCollection AddAbpProCap(this IServiceCollection service) + // { + // var configuration = service.GetConfiguration(); + // service.AddAbpCap(capOptions => + // { + // capOptions.SetCapDbConnectionString(configuration["ConnectionStrings:Default"]); + // capOptions.UseEntityFramework(); + // capOptions.UseRabbitMQ(option => + // { + // option.HostName = configuration.GetValue("Cap:RabbitMq:HostName"); + // option.UserName = configuration.GetValue("Cap:RabbitMq:UserName"); + // option.Password = configuration.GetValue("Cap:RabbitMq:Password"); + // option.Port = configuration.GetValue("Cap:RabbitMq:Port"); + // }); + // capOptions.UseDashboard(options => { options.AuthorizationPolicy = AbpProCapPermissions.CapManagement.Cap; }); + // }); + // return service; + // } + + // /// + // /// 注册hangfire + // /// + // public static IServiceCollection AddAbpProHangfire(this IServiceCollection service) + // { + // var redisStorageOptions = new RedisStorageOptions() + // { + // Db = service.GetConfiguration().GetValue("Hangfire:Redis:DB") + // }; + // + // service.Configure(options => { options.IsJobExecutionEnabled = true; }); + // + // service.AddHangfire(config => + // { + // config.UseRedisStorage(service.GetConfiguration().GetValue("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; + // } } \ No newline at end of file diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index 1eca8b03..3cef0b87 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -10,19 +10,14 @@ - - - - - - + diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 6a801ac7..0e33bb05 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/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( - 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) { - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services - .AddAbpProAuditLog() - .AddAbpProAuthentication() - .AddAbpProMultiTenancy() - .AddAbpProRedis() - .AddAbpProRedisDistributedLocking() - .AddAbpProMiniProfiler() - .AddAbpProCors() - .AddAbpProAntiForgery() - .AddAbpProIdentity() - .AddAbpProSignalR() - .AddAbpProHealthChecks() - .AddAbpProTenantResolvers() - .AddAbpProLocalization() - .AddAbpProExceptions() - .AddAbpProSwagger("AbpPro"); - } + context.Services + .AddAbpProAuditLog() + .AddAbpProJwtBearer() + .AddAbpProMultiTenancy() + .AddAbpProRedis() + .AddAbpProMiniProfiler() + .AddAbpProCors() + .AddAbpProAntiForgery() + .AddAbpProIdentity() + .AddAbpProSignalR() + .AddAbpProHealthChecks() + .AddAbpProTenantResolvers() + .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(); - 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 => - { - endpoints.MapHealthChecks("/health"); - - // endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions() - // { - // Authorization = new[] { new CustomHangfireAuthorizeFilter() }, - // IgnoreAntiforgeryToken = true - // }); - - }); - app.UseAbpProConsul(); - } + endpoints.MapHealthChecks("/health"); + }); + app.UseAbpProConsul(); } } \ No newline at end of file diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.Development.json b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.Development.json new file mode 100644 index 00000000..0ea4ea57 --- /dev/null +++ b/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" + } +} \ No newline at end of file diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/GlobalUsings.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/GlobalUsings.cs index e6931ff9..d7930f45 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/GlobalUsings.cs +++ b/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.Linq; global using System.Threading.Tasks; +global using Lion.AbpPro.AspNetCore; global using Microsoft.AspNetCore.Builder; global using Microsoft.AspNetCore.Cors; global using Microsoft.AspNetCore.Hosting; @@ -15,4 +16,5 @@ global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Logging; global using Ocelot.Middleware; global using Volo.Abp; +global using Volo.Abp.AspNetCore.Mvc; global using Volo.Abp.Modularity; \ No newline at end of file diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs index dad7db3c..09a9bc5f 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs +++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/MyProjectNameWebGatewayModule.cs @@ -1,10 +1,6 @@ -using Lion.AbpPro.AspNetCore; -using Volo.Abp.AspNetCore.Mvc; - -namespace Lion.AbpPro.WebGateway; +namespace MyCompanyName.MyProjectName.WebGateway; [DependsOn( - typeof(AbpAspNetCoreMvcModule), typeof(AbpProAspNetCoreModule))] public class MyProjectNameWebGatewayModule : AbpModule { diff --git a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs index c45d3b1c..214e507f 100644 --- a/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs +++ b/templates/pro-nuget/service/host/MyCompanyName.MyProjectName.WebGateway/Program.cs @@ -1,5 +1,3 @@ -using Lion.AbpPro.WebGateway; - namespace MyCompanyName.MyProjectName.WebGateway { public class Program diff --git a/templates/pro-nuget/service/icon.png b/templates/pro-nuget/service/icon.png new file mode 100644 index 00000000..c556047e Binary files /dev/null and b/templates/pro-nuget/service/icon.png differ diff --git a/templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs b/templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs index a8a1565a..072df546 100644 --- a/templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs +++ b/templates/pro-nuget/service/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs @@ -32,10 +32,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore }); Configure(options => { - options.UseNpgsql(builder => - { - builder.TranslateParameterizedCollectionsToConstants(); - }); + options.UseNpgsql(); }); } }