Browse Source

feat: 增加SqlServer启动配置

pull/1166/head
colin 10 months ago
parent
commit
3c2eae35cc
  1. 2
      aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs
  2. 8
      aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj
  3. 6
      aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs
  4. 16
      aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs
  5. 16
      aspnet-core/services/LY.MicroService.Applications.Single/Program.cs
  6. 12
      aspnet-core/services/LY.MicroService.Applications.Single/Properties/launchSettings.json
  7. 23
      aspnet-core/services/LY.MicroService.Applications.Single/appsettings.SqlServer.json

2
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;

8
aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj

@ -13,7 +13,6 @@
<PackageReference Include="AgileConfig.Client" />
<PackageReference Include="DistributedLock.Redis" />
<PackageReference Include="DotNetCore.CAP.Dashboard" />
<PackageReference Include="DotNetCore.CAP.MySql" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />
<PackageReference Include="DotNetCore.CAP.InMemoryStorage" />
<PackageReference Include="DotNetCore.CAP.RedisStreams " />
@ -43,7 +42,6 @@
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Volo.Abp.Autofac" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" />
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi" />
@ -118,7 +116,11 @@
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat.Work.HttpApi\LINGYUN.Abp.WeChat.Work.HttpApi.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat.Work\LINGYUN.Abp.WeChat.Work.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat\LINGYUN.Abp.WeChat.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\migrations\LY.MicroService.Applications.Single.EntityFrameworkCore.MySql\LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj" />
<!--<ProjectReference Include="..\..\migrations\LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer\LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer.csproj" />-->
</ItemGroup>
<ItemGroup>
@ -148,7 +150,6 @@
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Sms\LINGYUN.Abp.Elsa.Activities.Sms.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Webhooks\LINGYUN.Abp.Elsa.Activities.Webhooks.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities\LINGYUN.Abp.Elsa.Activities.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql\LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore\LINGYUN.Abp.Elsa.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
@ -247,7 +248,6 @@
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Notifications\LINGYUN.Abp.BackgroundTasks.Notifications.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Quartz\LINGYUN.Abp.BackgroundTasks.Quartz.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks\LINGYUN.Abp.BackgroundTasks.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.Quartz.MySqlInstaller\LINGYUN.Abp.Quartz.MySqlInstaller.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Application\LINGYUN.Abp.TaskManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Domain.Shared\LINGYUN.Abp.TaskManagement.Domain.Shared.csproj" />

6
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<AbpQuartzOptions>(options =>
{
// 如果使用持久化存储, 则配置quartz持久层
if (configuration.GetSection("Quartz:UsePersistentStore").Get<bool>())
if (configuration.GetValue("Quartz:UsePersistentStore", false))
{
var settings = configuration.GetSection("Quartz:Properties").Get<Dictionary<string, string>>();
if (settings != null)

16
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
{

16
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<MicroServiceApplicationsSingleModule>(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();

12
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"
}
}
}

23
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"
}
}
}
Loading…
Cancel
Save