diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs b/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs index 9db31b28f..45b1bcd62 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs @@ -36,7 +36,6 @@ global using LINGYUN.Abp.Demo.Localization; global using LINGYUN.Abp.Elsa; global using LINGYUN.Abp.Elsa.Activities; global using LINGYUN.Abp.Elsa.EntityFrameworkCore; -global using LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql; global using LINGYUN.Abp.EventBus.CAP; global using LINGYUN.Abp.ExceptionHandling; global using LINGYUN.Abp.ExceptionHandling.Emailing; @@ -126,6 +125,7 @@ global using LINGYUN.Platform.Localization; global using LINGYUN.Platform.Settings.VueVbenAdmin; global using LINGYUN.Platform.Theme.VueVbenAdmin; global using LY.MicroService.Applications.Single.EntityFrameworkCore.MySql; +//global using LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer; global using LY.MicroService.Applications.Single.Messages; global using Medallion.Threading; global using Medallion.Threading.Redis; diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj index 454b776f8..465b4b3ed 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj +++ b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj @@ -13,7 +13,6 @@ - @@ -43,7 +42,6 @@ - @@ -118,7 +116,11 @@ + + + + @@ -148,7 +150,6 @@ - @@ -247,7 +248,6 @@ - diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index 7f987d367..3226c5afc 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -52,10 +52,6 @@ public partial class MicroServiceApplicationsSingleModule return; } options - .UseMySql(sqlOptions => - { - configuration.GetSection("CAP:MySql").Bind(sqlOptions); - }) .UseRabbitMQ(rabbitMQOptions => { configuration.GetSection("CAP:RabbitMQ").Bind(rabbitMQOptions); @@ -165,7 +161,7 @@ public partial class MicroServiceApplicationsSingleModule PreConfigure(options => { // 如果使用持久化存储, 则配置quartz持久层 - if (configuration.GetSection("Quartz:UsePersistentStore").Get()) + if (configuration.GetValue("Quartz:UsePersistentStore", false)) { var settings = configuration.GetSection("Quartz:Properties").Get>(); if (settings != null) diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs index 7da8941fe..4c9c42d25 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs @@ -2,7 +2,6 @@ using LINGYUN.Abp.Identity.WeChat.Work; using LINGYUN.Abp.Notifications.Templating; using LINGYUN.Abp.Notifications.WeChat.Work; using LINGYUN.Abp.OssManagement.Minio; -using LINGYUN.Abp.Quartz.MySqlInstaller; namespace LY.MicroService.Applications.Single; @@ -231,10 +230,6 @@ namespace LY.MicroService.Applications.Single; // 权限管理模块 组织机构集成 typeof(AbpPermissionManagementDomainOrganizationUnitsModule), // 组织机构权限管理 - typeof(SingleMigrationsEntityFrameworkCoreMySqlModule), - // 实体框架MySQL集成 - // typeof(AbpEntityFrameworkCoreMySQLModule), - // 短信模块 阿里云集成 typeof(AbpAliyunSmsModule), // 阿里云模块 设置管理 @@ -265,8 +260,6 @@ namespace LY.MicroService.Applications.Single; typeof(AbpBackgroundTasksNotificationsModule), // 后台任务模块 Quartz集成 typeof(AbpBackgroundTasksQuartzModule), - // Quartz MySql数据库初始化模块 - typeof(AbpQuartzMySqlInstallerModule), // 数据审计模块 应用服务 typeof(AbpDataProtectionManagementApplicationModule), @@ -366,8 +359,6 @@ namespace LY.MicroService.Applications.Single; typeof(AbpElsaActivitiesModule), // Elsa工作流模块 实体框架 typeof(AbpElsaEntityFrameworkCoreModule), - // Elsa工作流模块 MySql集成 - typeof(AbpElsaEntityFrameworkCoreMySqlModule), // 数据导出模块 MiniExcel集成 typeof(AbpExporterMiniExcelModule), @@ -377,7 +368,12 @@ namespace LY.MicroService.Applications.Single; typeof(AbpAspNetCoreMvcIdempotentWrapperModule), typeof(AbpAspNetCoreHttpOverridesModule), typeof(AbpMailKitModule), - typeof(AbpAutofacModule) + typeof(AbpAutofacModule), + + // 取消注释使用MySql + typeof(SingleMigrationsEntityFrameworkCoreMySqlModule) + // 取消注释使用SqlServer + //typeof(SingleMigrationsEntityFrameworkCoreSqlServerModule) )] public partial class MicroServiceApplicationsSingleModule : AbpModule { diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs b/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs index a180dbc14..32c298006 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs @@ -1,8 +1,5 @@ -using LINGYUN.Abp.Identity.Session.AspNetCore; using LY.MicroService.Applications.Single; -using Microsoft.AspNetCore.Cors; using Serilog; -using TencentCloud.Tsf.V20180326.Models; using Volo.Abp.IO; using Volo.Abp.Modularity.PlugIns; @@ -30,6 +27,12 @@ builder.Host.AddAppSettingsSecretsJson() .UseAutofac() .ConfigureAppConfiguration((context, config) => { + var dbProvider = Environment.GetEnvironmentVariable("APPLICATION_DATABASE_PROVIDER"); + if (!dbProvider.IsNullOrWhiteSpace()) + { + config.AddJsonFile($"appsettings.{dbProvider}.json", optional: true); + } + var configuration = config.Build(); if (configuration.GetValue("AgileConfig:IsEnabled", false)) { @@ -48,12 +51,9 @@ await builder.AddApplicationAsync(options options.ApplicationName = MicroServiceApplicationsSingleModule.ApplicationName; options.Configuration.UserSecretsId = Environment.GetEnvironmentVariable("APPLICATION_USER_SECRETS_ID"); options.Configuration.UserSecretsAssembly = typeof(MicroServiceApplicationsSingleModule).Assembly; - var pluginFolder = Path.Combine( - Directory.GetCurrentDirectory(), "Modules"); + var pluginFolder = Path.Combine(Directory.GetCurrentDirectory(), "Modules"); DirectoryHelper.CreateIfNotExists(pluginFolder); - options.PlugInSources.AddFolder( - pluginFolder, - SearchOption.AllDirectories); + options.PlugInSources.AddFolder(pluginFolder,SearchOption.AllDirectories); }); var app = builder.Build(); diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/Properties/launchSettings.json b/aspnet-core/services/LY.MicroService.Applications.Single/Properties/launchSettings.json index 1e25c86dd..9746401ed 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/Properties/launchSettings.json +++ b/aspnet-core/services/LY.MicroService.Applications.Single/Properties/launchSettings.json @@ -8,22 +8,24 @@ } }, "profiles": { - "LY.MicroService.Applications.Single": { + "Single.MySql.Dev": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, "applicationUrl": "http://0.0.0.0:30001", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "APPLICATION_DATABASE_PROVIDER": "MySql" } }, - "LY.MicroService.Applications.Single.Development": { + "Single.SqlServer.Dev": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://0.0.0.0:30000", + "applicationUrl": "http://0.0.0.0:30001", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "APPLICATION_DATABASE_PROVIDER": "SqlServer" } } } diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.SqlServer.json b/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.SqlServer.json new file mode 100644 index 000000000..6a942a894 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.SqlServer.json @@ -0,0 +1,23 @@ +{ + "ConnectionStrings": { + "Default": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false" + }, + "CAP": { + "SqlServer": { + "TableNamePrefix": "pt_event", + "ConnectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false" + } + }, + "Quartz": { + "Properties": { + "quartz.jobStore.dataSource": "tkm", + "quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", + "quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.SqlServerDelegate,Quartz", + "quartz.dataSource.tkm.connectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=sa;Password=P@ssw@rd!;Encrypt=false", + "quartz.dataSource.tkm.provider": "SqlServer", + "quartz.jobStore.clustered": true, + "quartz.checkConfiguration": "false", + "quartz.serializer.type": "json" + } + } +} \ No newline at end of file