Browse Source

Merge pull request #937 from colinin/fix-migrations

fix(migrations): 修复初始化迁移数据不全的问题.
pull/955/head
yx lin 2 years ago
committed by GitHub
parent
commit
7eebffd5b8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 30
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 14
      aspnet-core/LINGYUN.MicroService.SingleProject.sln
  3. 15
      aspnet-core/create-database.bat
  4. 3
      aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml
  5. 30
      aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd
  6. 6
      aspnet-core/migrate-database.bat
  7. 2
      aspnet-core/migrate-db-cmd.bat
  8. 2
      aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs
  9. 5
      aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json
  10. 2
      aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs
  11. 31
      aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs
  12. 135
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs
  13. 46
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/RolePermissionDataSeedContributor.cs
  14. 2
      aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs
  15. 5
      aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json
  16. 2
      aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs
  17. 21
      aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs
  18. 3
      aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json
  19. 1
      aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj
  20. 2
      aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs
  21. 21
      aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs
  22. 9
      aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs
  23. 11
      aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json
  24. 65
      aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs
  25. 2
      aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs
  26. 27
      aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs
  27. 3
      aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json
  28. 3
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs
  29. 12
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs
  30. 2
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs
  31. 7
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json
  32. 7
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json
  33. 15
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/RecycleStrategy.cs
  34. 11
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs
  35. 2
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs
  36. 1
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj
  37. 61
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs
  38. 28
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureNames.cs
  39. 78
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs
  40. 3
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/FodyWeavers.xml
  41. 30
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN.Abp.Saas.Jobs.csproj
  42. 29
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/AbpSaasJobsModule.cs
  43. 12
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/LocalizableStatic.cs
  44. 8
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/en.json
  45. 8
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/zh-Hans.json
  46. 14
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/SaasJobDefinitionProvider.cs
  47. 65
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/TenantUsageMonitoringJob.cs
  48. 9
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs
  49. 162
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md
  50. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs
  51. 20
      aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json
  52. 20
      aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json
  53. 2
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json
  54. 18
      aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json
  55. 20
      aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json
  56. 15
      aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
  57. 2
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
  58. 26
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json
  59. 4
      starter/01.create database.cmd
  60. 0
      starter/02.migrate-db.cmd

30
aspnet-core/LINGYUN.MicroService.All.sln

@ -707,7 +707,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "security", "{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Security", "framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj", "{4C71CA88-0D04-4DDB-8906-B953908B8B8B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.Jobs", "modules\task-management\LINGYUN.Abp.BackgroundTasks.Jobs\LINGYUN.Abp.BackgroundTasks.Jobs.csproj", "{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.Application.Contracts", "modules\task-management\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj", "{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TaskManagement.HttpApi.Client", "modules\task-management\LINGYUN.Abp.TaskManagement.HttpApi.Client\LINGYUN.Abp.TaskManagement.HttpApi.Client.csproj", "{72D54834-7ADF-4B18-A745-FCBBC255073B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1799,6 +1807,22 @@ Global
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C71CA88-0D04-4DDB-8906-B953908B8B8B}.Release|Any CPU.Build.0 = Release|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE}.Release|Any CPU.Build.0 = Release|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A}.Release|Any CPU.Build.0 = Release|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE}.Release|Any CPU.Build.0 = Release|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72D54834-7ADF-4B18-A745-FCBBC255073B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -2141,6 +2165,10 @@ Global
{AAC0C407-B4B9-4E90-99FC-2D793AC229D9} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{9D1302BE-3886-49F8-B0CD-35D2AC1E5A37} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{4C71CA88-0D04-4DDB-8906-B953908B8B8B} = {9D1302BE-3886-49F8-B0CD-35D2AC1E5A37}
{50FF92EA-8BA4-445D-AB04-E7568EE5D3FE} = {77ED7922-BF30-4436-8A85-78F812583913}
{1E00BE51-A1AE-447D-B6E0-F28EC12B259A} = {77ED7922-BF30-4436-8A85-78F812583913}
{61F0EEB2-5ED0-4809-8EF9-0676C7A680CE} = {77ED7922-BF30-4436-8A85-78F812583913}
{72D54834-7ADF-4B18-A745-FCBBC255073B} = {77ED7922-BF30-4436-8A85-78F812583913}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

14
aspnet-core/LINGYUN.MicroService.SingleProject.sln

@ -508,6 +508,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Work.Com
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AuditLogging.Elasticsearch", "framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj", "{66A6E78D-E547-4DD7-9844-087FAB3D03C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BackgroundTasks.TaskManagement", "modules\task-management\LINGYUN.Abp.BackgroundTasks.TaskManagement\LINGYUN.Abp.BackgroundTasks.TaskManagement.csproj", "{A99F5406-37DC-4677-9166-9BDE90C26CA6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Saas.Jobs", "modules\saas\LINGYUN.Abp.Saas.Jobs\LINGYUN.Abp.Saas.Jobs.csproj", "{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1334,6 +1338,14 @@ Global
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66A6E78D-E547-4DD7-9844-087FAB3D03C2}.Release|Any CPU.Build.0 = Release|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A99F5406-37DC-4677-9166-9BDE90C26CA6}.Release|Any CPU.Build.0 = Release|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1583,6 +1595,8 @@ Global
{C4690A20-8628-4A39-8E71-2D09800D0E72} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{8233A44F-4DFC-4701-9C04-834FD3C97060} = {91867618-0D86-4410-91C6-B1166A9ACDF9}
{66A6E78D-E547-4DD7-9844-087FAB3D03C2} = {C22741F9-FC56-4AE3-B543-9F15C779D345}
{A99F5406-37DC-4677-9166-9BDE90C26CA6} = {D9C65C9D-8591-46DA-A3EE-419393E607AB}
{8FA3ED81-19AB-4E0C-B36A-DF49131A2AB3} = {0DF5AD76-AEEA-4052-A6CA-A44C24879F11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1}

15
aspnet-core/create-database.bat

@ -0,0 +1,15 @@
@echo off
cls
call .\migrate-db-cmd.bat LY.MicroService.Platform.EntityFrameworkCore platform --ef-u
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.EntityFrameworkCore admin --ef-u
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.EntityFrameworkCore auth-server --ef-u
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.EntityFrameworkCore identityserver4-admin --ef-u
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.EntityFrameworkCore localization --ef-u
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.EntityFrameworkCore messages --ef-u
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.EntityFrameworkCore task-management --ef-u
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.EntityFrameworkCore webhooks-management --ef-u
taskkill /IM dotnet.exe /F
pause

3
aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

30
aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

6
aspnet-core/migrate-database.bat

@ -1,12 +1,14 @@
@echo off
cls
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.AuthServer.DbMigrator auth-server --run
call .\migrate-db-cmd.bat LY.MicroService.IdentityServer.DbMigrator identityserver4-admin --run
call .\migrate-db-cmd.bat LY.MicroService.LocalizationManagement.DbMigrator localization --run
call .\migrate-db-cmd.bat LY.MicroService.Platform.DbMigrator platform --run
call .\migrate-db-cmd.bat LY.MicroService.RealtimeMessage.DbMigrator messages --run
call .\migrate-db-cmd.bat LY.MicroService.TaskManagement.DbMigrator task-management --run
call .\migrate-db-cmd.bat LY.MicroService.WebhooksManagement.DbMigrator webhooks-management --run
call .\migrate-db-cmd.bat LY.MicroService.BackendAdmin.DbMigrator admin --run
pause

2
aspnet-core/migrate-db-cmd.bat

@ -22,7 +22,7 @@ dotnet restore
goto end
:efu
dotnet ef databse update
dotnet ef database update
goto end
:end

2
aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/AuthServerDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class AuthServerDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
//options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

5
aspnet-core/migrations/LY.MicroService.AuthServer.DbMigrator/appsettings.json

@ -4,7 +4,10 @@
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",

2
aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class BackendAdminDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

31
aspnet-core/migrations/LY.MicroService.BackendAdmin.DbMigrator/BackendAdminDbMigratorModule.cs

@ -1,6 +1,12 @@
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using LINGYUN.Abp.TextTemplating;
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Features;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
namespace LY.MicroService.BackendAdmin.DbMigrator;
@ -10,4 +16,27 @@ namespace LY.MicroService.BackendAdmin.DbMigrator;
)]
public partial class BackendAdminDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<SettingManagementOptions>(options =>
{
options.IsDynamicSettingStoreEnabled = true;
options.SaveStaticSettingsToDatabase = true;
});
Configure<FeatureManagementOptions>(options =>
{
options.IsDynamicFeatureStoreEnabled = true;
options.SaveStaticFeaturesToDatabase = true;
});
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
options.SaveStaticPermissionsToDatabase = true;
});
Configure<AbpTextTemplatingCachingOptions>(options =>
{
options.IsDynamicTemplateDefinitionStoreEnabled = true;
options.SaveStaticTemplateDefinitionToDatabase = true;
});
}
}

135
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/BackendAdminDbMigrationEventHandler.cs

@ -1,27 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Migrations;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore;
public class BackendAdminDbMigrationEventHandler : EfCoreDatabaseMigrationEventHandlerBase<BackendAdminMigrationsDbContext>
{
private const string ModelDatabaseProviderAnnotationKey = "_Abp_DatabaseProvider";
protected IPermissionGrantRepository PermissionGrantRepository { get; }
protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
protected IDataSeeder DataSeeder { get; }
public BackendAdminDbMigrationEventHandler(
ICurrentTenant currentTenant,
@ -29,129 +19,16 @@ public class BackendAdminDbMigrationEventHandler : EfCoreDatabaseMigrationEventH
ITenantStore tenantStore,
IDistributedEventBus distributedEventBus,
ILoggerFactory loggerFactory,
IPermissionGrantRepository permissionGrantRepository,
IPermissionDefinitionManager permissionDefinitionManager)
IDataSeeder dataSeeder)
: base(
ConnectionStringNameAttribute.GetConnStringName<BackendAdminMigrationsDbContext>(),
currentTenant, unitOfWorkManager, tenantStore, distributedEventBus, loggerFactory)
{
PermissionGrantRepository = permissionGrantRepository;
PermissionDefinitionManager = permissionDefinitionManager;
}
protected async override Task AfterTenantConnectionStringUpdated(TenantConnectionStringUpdatedEto eventData, bool schemaMigrated)
{
if (!schemaMigrated ||
string.Equals(eventData.ConnectionStringName, AbpPermissionManagementDbProperties.ConnectionStringName, StringComparison.InvariantCultureIgnoreCase))
{
return;
}
await SeedAdminRolePermissionsAsync(eventData.Id);
}
protected async override Task AfterTenantCreated(TenantCreatedEto eventData, bool schemaMigrated)
{
if (!schemaMigrated)
{
return;
}
await SeedAdminRolePermissionsAsync(eventData.Id);
}
protected async virtual Task SeedAdminRolePermissionsAsync(Guid tenantId)
{
using (CurrentTenant.Change(tenantId))
{
Logger.LogInformation("Seeding the new tenant admin role permissions...");
var definitionPermissions = await PermissionDefinitionManager.GetPermissionsAsync();
var grantPermissions = definitionPermissions
.Where(p => p.MultiTenancySide.HasFlag(MultiTenancySides.Tenant))
.Select(p => p.Name).ToArray();
//var grantPermissions = new List<PermissionGrant>();
//foreach (var permission in definitionPermissions)
//{
// var permissionGrant = new PermissionGrant(GuidGenerator.Create(),
// permission.Name, "R", "admin", eventData.Id);
// grantPermissions.Add(permissionGrant);
//}
// TODO: MySql 批量新增还是一条一条的语句?
// await PermissionGrantRepository.GetDbSet().AddRangeAsync(grantPermissions);
var dbContext = await PermissionGrantRepository.GetDbContextAsync();
var dbProvider = (EfCoreDatabaseProvider?)dbContext.Model[ModelDatabaseProviderAnnotationKey];
if (dbProvider != null)
{
var permissionEntityType = dbContext.Model.FindEntityType(typeof(PermissionGrant));
var permissionTableName = permissionEntityType.GetTableName();
var batchInsertPermissionSql = string.Empty;
switch (dbProvider)
{
case EfCoreDatabaseProvider.MySql:
batchInsertPermissionSql = BuildMySqlBatchInsertScript(permissionTableName, tenantId, grantPermissions);
break;
case EfCoreDatabaseProvider.SqlServer:
batchInsertPermissionSql = BuildSqlServerBatchInsertScript(permissionTableName, tenantId, grantPermissions);
break;
default:
Logger.LogWarning($"Tenant permissions data has not initialized, Because database provider: {dbProvider} batch statements are not defined!");
return;
}
await dbContext.Database.ExecuteSqlRawAsync(batchInsertPermissionSql);
Logger.LogInformation("The new tenant permissions data initialized!");
}
}
}
protected virtual string BuildMySqlBatchInsertScript(string tableName, Guid tenantId, string[] permissions)
{
var batchInsertPermissionSql = new StringBuilder(128);
batchInsertPermissionSql.AppendLine($"INSERT INTO `{tableName}`(`Id`, `TenantId`, `Name`, `ProviderName`, `ProviderKey`)");
batchInsertPermissionSql.AppendLine("VALUES");
for (int i = 0; i < permissions.Length; i++)
{
batchInsertPermissionSql.AppendLine($"(UUID(), '{tenantId}','{permissions[i]}','R','admin')");
if (i < permissions.Length - 1)
{
batchInsertPermissionSql.AppendLine(",");
}
}
return batchInsertPermissionSql.ToString();
}
protected virtual string BuildSqlServerBatchInsertScript(string tableName, Guid tenantId, string[] permissions)
{
var batchInsertPermissionSql = new StringBuilder(128);
batchInsertPermissionSql.AppendLine($"INSERT INTO {tableName}(Id, TenantId, Name, ProviderName, ProviderKey)");
batchInsertPermissionSql.Append("VALUES");
for (int i = 0; i < permissions.Length; i++)
{
batchInsertPermissionSql.AppendLine($"(NEWID(), '{tenantId}','{permissions[i]}','R','admin')");
if (i < permissions.Length - 1)
{
batchInsertPermissionSql.AppendLine(",");
}
}
return batchInsertPermissionSql.ToString();
}
protected virtual string BuildMySqlBatchDeleteScript(string tableName, Guid tenantId)
{
var batchRemovePermissionSql = new StringBuilder(128);
batchRemovePermissionSql.AppendLine($"DELETE FROM `{tableName}` WHERE `TenantId` = '{tenantId}'");
batchRemovePermissionSql.AppendLine("AND `ProviderName`='R' AND `ProviderKey`='admin'");
return batchRemovePermissionSql.ToString();
DataSeeder = dataSeeder;
}
protected virtual string BuildSqlServerBatchDeleteScript(string tableName, Guid tenantId)
protected async override Task SeedAsync(Guid? tenantId)
{
var batchRemovePermissionSql = new StringBuilder(128);
batchRemovePermissionSql.AppendLine($"DELETE {tableName} WHERE TenantId = '{tenantId}'");
batchRemovePermissionSql.AppendLine("AND ProviderName='R' AND ProviderKey='admin'");
return batchRemovePermissionSql.ToString();
await DataSeeder.SeedAsync(tenantId);
}
}

46
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/RolePermissionDataSeedContributor.cs

@ -0,0 +1,46 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore;
public class RolePermissionDataSeedContributor : IDataSeedContributor
{
public ILogger<RolePermissionDataSeedContributor> Logger { protected get; set; }
protected ICurrentTenant CurrentTenant { get; }
protected IPermissionDataSeeder PermissionDataSeeder { get; }
protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
public RolePermissionDataSeedContributor(
ICurrentTenant currentTenant,
IPermissionDataSeeder permissionDataSeeder,
IPermissionDefinitionManager permissionDefinitionManager)
{
CurrentTenant = currentTenant;
PermissionDataSeeder = permissionDataSeeder;
PermissionDefinitionManager = permissionDefinitionManager;
Logger = NullLogger<RolePermissionDataSeedContributor>.Instance;
}
public async virtual Task SeedAsync(DataSeedContext context)
{
using (CurrentTenant.Change(context.TenantId))
{
Logger.LogInformation("Seeding the new tenant admin role permissions...");
var definitionPermissions = await PermissionDefinitionManager.GetPermissionsAsync();
await PermissionDataSeeder.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
definitionPermissions.Select(x => x.Name),
context.TenantId);
}
}
}

2
aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/IdentityServerDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class IdentityServerDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

5
aspnet-core/migrations/LY.MicroService.IdentityServer.DbMigrator/appsettings.json

@ -7,7 +7,10 @@
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"IdentityServer": {
"Clients": {

2
aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class LocalizationManagementDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

21
aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/LocalizationManagementDbMigratorModule.cs

@ -1,6 +1,9 @@
using LY.MicroService.LocalizationManagement.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
namespace LY.MicroService.LocalizationManagement.DbMigrator;
@ -10,4 +13,22 @@ namespace LY.MicroService.LocalizationManagement.DbMigrator;
)]
public partial class LocalizationManagementDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<SettingManagementOptions>(options =>
{
options.IsDynamicSettingStoreEnabled = true;
options.SaveStaticSettingsToDatabase = true;
});
Configure<FeatureManagementOptions>(options =>
{
options.IsDynamicFeatureStoreEnabled = true;
options.SaveStaticFeaturesToDatabase = true;
});
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
options.SaveStaticPermissionsToDatabase = true;
});
}
}

3
aspnet-core/migrations/LY.MicroService.LocalizationManagement.DbMigrator/appsettings.json

@ -4,7 +4,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",

1
aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/LY.MicroService.Platform.DbMigrator.csproj

@ -11,6 +11,7 @@
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" />
<PackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
<PackageReference Include="Serilog.Settings.Configuration" Version="$(SerilogSettingsConfigurationPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftEntityFrameworkCorePackageVersion)">
<PrivateAssets>all</PrivateAssets>

2
aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class PlatformDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

21
aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/PlatformDbMigratorModule.cs

@ -1,7 +1,10 @@
using LINGYUN.Abp.UI.Navigation.VueVbenAdmin;
using LY.MicroService.Platform.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
namespace LY.MicroService.Platform.DbMigrator;
@ -12,4 +15,22 @@ namespace LY.MicroService.Platform.DbMigrator;
)]
public partial class PlatformDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<SettingManagementOptions>(options =>
{
options.IsDynamicSettingStoreEnabled = true;
options.SaveStaticSettingsToDatabase = true;
});
Configure<FeatureManagementOptions>(options =>
{
options.IsDynamicFeatureStoreEnabled = true;
options.SaveStaticFeaturesToDatabase = true;
});
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
options.SaveStaticPermissionsToDatabase = true;
});
}
}

9
aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/Program.cs

@ -13,14 +13,14 @@ public class Program
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Debug)
#if DEBUG
.MinimumLevel.Override("LY.MicroService.Platform.DbMigrator", LogEventLevel.Debug)
.MinimumLevel.Override("LY.MicroService.Platform", LogEventLevel.Debug)
#else
.MinimumLevel.Override("LY.MicroService.Platform.DbMigrator", LogEventLevel.Information)
.MinimumLevel.Override("LY.MicroService.Platform", LogEventLevel.Information)
#endif
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.Console(outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}")
.WriteTo.File("Logs/migrations.txt")
.CreateLogger();
@ -31,7 +31,6 @@ public class Program
{
return Host.CreateDefaultBuilder(args)
.AddAppSettingsSecretsJson()
.ConfigureLogging((context, logging) => logging.ClearProviders())
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<PlatformDbMigratorHostedService>();

11
aspnet-core/migrations/LY.MicroService.Platform.DbMigrator/appsettings.json

@ -5,7 +5,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",
@ -14,11 +15,11 @@
},
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Default": "Debug",
"Override": {
"System": "Warning",
"Microsoft": "Warning",
"DotNetCore": "Information"
"System": "Debug",
"Microsoft": "Debug",
"DotNetCore": "Debug"
}
},
"Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ],

65
aspnet-core/migrations/LY.MicroService.Platform.EntityFrameworkCore/PlatformDbMigrationEventHandler.cs

@ -1,40 +1,89 @@
using Microsoft.Extensions.Logging;
using LINGYUN.Abp.Saas.Features;
using LINGYUN.Abp.Saas.Tenants;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System;
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore.Migrations;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
namespace LY.MicroService.Platform.EntityFrameworkCore;
public class PlatformDbMigrationEventHandler : EfCoreDatabaseMigrationEventHandlerBase<PlatformMigrationsDbContext>
public class PlatformDbMigrationEventHandler :
EfCoreDatabaseMigrationEventHandlerBase<PlatformMigrationsDbContext>,
IDistributedEventHandler<TenantDeletedEto>
{
protected IDataSeeder DataSeeder { get; }
protected IFeatureChecker FeatureChecker { get; }
protected IConfiguration Configuration { get; }
public PlatformDbMigrationEventHandler(
ICurrentTenant currentTenant,
IUnitOfWorkManager unitOfWorkManager,
ITenantStore tenantStore,
IDistributedEventBus distributedEventBus,
ILoggerFactory loggerFactory,
IDataSeeder dataSeeder)
IDataSeeder dataSeeder,
IFeatureChecker featureChecker,
IConfiguration configuration)
: base(
ConnectionStringNameAttribute.GetConnStringName<PlatformMigrationsDbContext>(),
currentTenant, unitOfWorkManager, tenantStore, distributedEventBus, loggerFactory)
{
DataSeeder = dataSeeder;
FeatureChecker = featureChecker;
Configuration = configuration;
}
protected async override Task AfterTenantCreated(TenantCreatedEto eventData, bool schemaMigrated)
protected async override Task SeedAsync(Guid? tenantId)
{
if (!schemaMigrated)
using (CurrentTenant.Change(tenantId))
{
return;
await DataSeeder.SeedAsync(tenantId);
}
}
public async virtual Task HandleEventAsync(TenantDeletedEto eventData)
{
var hostDefaultConnectionString = Configuration.GetConnectionString(ConnectionStrings.DefaultConnectionStringName);
using (CurrentTenant.Change(eventData.Id))
{
await DataSeeder.SeedAsync(eventData.Id);
// 租户删除时的资源回收策略
var strategyFeature = await FeatureChecker.GetOrNullAsync(SaasFeatureNames.Tenant.RecycleStrategy);
if (!strategyFeature.IsNullOrWhiteSpace() && Enum.TryParse<RecycleStrategy>(strategyFeature, out var strategy))
{
// 需要回收策略为回收且存在默认连接字符串且默认连接字符串与宿主不同
if (strategy == RecycleStrategy.Recycle && !eventData.DefaultConnectionString.IsNullOrWhiteSpace())
{
var hostConnection = new DbConnectionStringBuilder()
{
ConnectionString = hostDefaultConnectionString,
};
var tenantConnection = new DbConnectionStringBuilder()
{
ConnectionString = eventData.DefaultConnectionString,
};
if (hostConnection.EquivalentTo(tenantConnection))
{
return;
}
using var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var buildr = new DbContextOptionsBuilder();
buildr.UseMySql(eventData.DefaultConnectionString, ServerVersion.AutoDetect(eventData.DefaultConnectionString));
await using var dbConnection = new DbContext(buildr.Options);
if ((await dbConnection.Database.GetAppliedMigrationsAsync()).Any())
{
await dbConnection.Database.EnsureDeletedAsync();
}
}
}
}
}
}

2
aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorHostedService.cs

@ -29,7 +29,7 @@ public class RealtimeMessageDbMigratorHostedService : IHostedService
options.Services.ReplaceConfiguration(_configuration);
options.UseAutofac();
options.Services.AddLogging(c => c.AddSerilog());
options.AddDataMigrationEnvironment();
// options.AddDataMigrationEnvironment();
});
await application.InitializeAsync();

27
aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/RealtimeMessageDbMigratorModule.cs

@ -1,7 +1,11 @@
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Notifications;
using LY.MicroService.RealtimeMessage.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
namespace LY.MicroService.RealtimeMessage.DbMigrator;
@ -12,4 +16,27 @@ namespace LY.MicroService.RealtimeMessage.DbMigrator;
)]
public partial class RealtimeMessageDbMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<SettingManagementOptions>(options =>
{
options.IsDynamicSettingStoreEnabled = true;
options.SaveStaticSettingsToDatabase = true;
});
Configure<FeatureManagementOptions>(options =>
{
options.IsDynamicFeatureStoreEnabled = true;
options.SaveStaticFeaturesToDatabase = true;
});
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
options.SaveStaticPermissionsToDatabase = true;
});
Configure<AbpNotificationsManagementOptions>(options =>
{
options.IsDynamicNotificationsStoreEnabled = true;
options.SaveStaticNotificationsToDatabase = true;
});
}
}

3
aspnet-core/migrations/LY.MicroService.RealtimeMessage.DbMigrator/appsettings.json

@ -6,7 +6,8 @@
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"StringEncryption": {
"DefaultPassPhrase": "s46c5q55nxpeS8Ra",

3
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs

@ -8,8 +8,7 @@ namespace LINGYUN.Abp.Notifications.EntityFrameworkCore;
[DependsOn(
typeof(AbpCachingModule),
typeof(AbpAutoMapperModule),
typeof(AbpNotificationsModule),
typeof(AbpNotificationsDomainSharedModule))]
typeof(AbpNotificationsDomainModule))]
public class AbpNotificationsEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

12
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/Tenants/TenantAppService.cs

@ -153,6 +153,18 @@ public class TenantAppService : AbpSaasAppServiceBase, ITenantAppService
{
return;
}
var eto = new TenantDeletedEto
{
Id = tenant.Id,
Name = tenant.Name,
EntityVersion = tenant.EntityVersion,
DefaultConnectionString = tenant.FindDefaultConnectionString(),
};
CurrentUnitOfWork.OnCompleted(async () =>
{
await EventBus.PublishAsync(eto);
});
await TenantRepository.DeleteAsync(tenant);
await CurrentUnitOfWork.SaveChangesAsync();

2
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Editions/EditionEto.cs

@ -1,9 +1,11 @@
using System;
using Volo.Abp.Auditing;
using Volo.Abp.EventBus;
namespace LINGYUN.Abp.Saas.Editions;
[Serializable]
[EventName("abp.saas.edition")]
public class EditionEto : IHasEntityVersion
{
public Guid Id { get; set; }

7
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json

@ -28,6 +28,7 @@
"DisplayName:EnableTime": "Enable Time",
"DisplayName:DisableTime": "Disable Time",
"ManageHostFeatures": "Manage Host features",
"Features:Saas": "Saas",
"Permission:Saas": "Saas",
"Permission:EditionManagement": "Edition management",
"Permission:TenantManagement": "Tenant management",
@ -38,6 +39,12 @@
"Permission:ManageFeatures": "Manage features",
"DisplayName:AdminEmailAddress": "Admin Email Address",
"DisplayName:AdminPassword": "Admin Password",
"Features:RecycleStrategy": "Recycle Strategy",
"Features:RecycleStrategyDesc": "This section describes how to set the resource reclamation policy for tenants after the grace period expires",
"Features:ExpirationReminderDays": "Expired warning days",
"Features:ExpirationReminderDaysDesc": "Send a reminder to the administrator when the resource has how many days left to expire",
"Features:ExpiredRecoveryTime": "Expired Recovery Time",
"Features:ExpiredRecoveryTimeDesc": "If the resource expiration is not handled for a long time, tenant resources will be reclaimed",
"TenantNotFoundById": "Tenant: {0} not found!",
"TenantNotFoundByName": "Tenant: {0} not found!",
"UnActived": "UnActived"

7
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json

@ -28,6 +28,7 @@
"DisplayName:EnableTime": "启用时间",
"DisplayName:DisableTime": "禁用时间",
"ManageHostFeatures": "管理Host特性",
"Features:Saas": "Saas",
"Permission:Saas": "Saas",
"Permission:EditionManagement": "版本管理",
"Permission:TenantManagement": "租户管理",
@ -38,6 +39,12 @@
"Permission:ManageFeatures": "管理功能",
"DisplayName:AdminEmailAddress": "管理员电子邮件地址",
"DisplayName:AdminPassword": "管理员密码",
"Features:RecycleStrategy": "资源回收策略",
"Features:RecycleStrategyDesc": "设定租户超过宽限过期时间后的资源回收策略",
"Features:ExpirationReminderDays": "过期预警天数",
"Features:ExpirationReminderDaysDesc": "当资源还有多少天过期时, 给管理员发送提醒",
"Features:ExpiredRecoveryTime": "过期回收时长",
"Features:ExpiredRecoveryTimeDesc": "当资源超期多久没有处理, 将回收租户资源",
"TenantNotFoundById": "租户: {0} 不存在!",
"TenantNotFoundByName": "租户: {0} 不存在!",
"UnActived": "未启用"

15
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/RecycleStrategy.cs

@ -0,0 +1,15 @@
namespace LINGYUN.Abp.Saas.Tenants;
/// <summary>
/// 资源回收策略
/// </summary>
public enum RecycleStrategy
{
/// <summary>
/// 保留
/// </summary>
Reserve,
/// <summary>
/// 回收
/// </summary>
Recycle,
}

11
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantDeletedEto.cs

@ -0,0 +1,11 @@
using System;
using Volo.Abp.EventBus;
namespace LINGYUN.Abp.Saas.Tenants;
[Serializable]
[EventName("abp.saas.tenant.deleted")]
public class TenantDeletedEto : TenantEto
{
public string DefaultConnectionString { get; set; }
}

2
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Tenants/TenantEto.cs

@ -1,9 +1,11 @@
using System;
using Volo.Abp.Auditing;
using Volo.Abp.EventBus;
namespace LINGYUN.Abp.Saas.Tenants;
[Serializable]
[EventName("abp.saas.tenant")]
public class TenantEto : IHasEntityVersion
{
public Guid Id { get; set; }

1
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj

@ -12,6 +12,7 @@
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Caching" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Features" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>

61
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureDefinitionProvider.cs

@ -0,0 +1,61 @@
using LINGYUN.Abp.Saas.Localization;
using LINGYUN.Abp.Saas.Tenants;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.Validation.StringValues;
namespace LINGYUN.Abp.Saas.Features;
public class SaasFeatureDefinitionProvider : FeatureDefinitionProvider
{
public override void Define(IFeatureDefinitionContext context)
{
var saas = context.AddGroup(
name: SaasFeatureNames.GroupName,
displayName: L("Features:Saas"));
var selectionValueType = new SelectionStringValueType
{
ItemSource = new StaticSelectionStringValueItemSource(
new LocalizableSelectionStringValueItem
{
Value = RecycleStrategy.Reserve.ToString(),
DisplayText = new LocalizableStringInfo(
LocalizationResourceNameAttribute.GetName(typeof(AbpSaasResource)),
"RecycleStrategy:Reserve")
},
new LocalizableSelectionStringValueItem
{
Value = RecycleStrategy.Recycle.ToString(),
DisplayText = new LocalizableStringInfo(
LocalizationResourceNameAttribute.GetName(typeof(AbpSaasResource)),
"RecycleStrategy:Recycle")
})
};
saas.AddFeature(
name: SaasFeatureNames.Tenant.RecycleStrategy,
defaultValue: RecycleStrategy.Recycle.ToString(),
displayName: L("Features:RecycleStrategy"),
description: L("Features:RecycleStrategyDesc"),
valueType: selectionValueType,
isAvailableToHost: false);
saas.AddFeature(
name: SaasFeatureNames.Tenant.ExpirationReminderDays,
defaultValue: 15.ToString(),
displayName: L("Features:ExpirationReminderDays"),
description: L("Features:ExpirationReminderDaysDesc"),
valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
isAvailableToHost: false);
saas.AddFeature(
name: SaasFeatureNames.Tenant.ExpiredRecoveryTime,
defaultValue: 15.ToString(),
displayName: L("Features:ExpiredRecoveryTime"),
description: L("Features:ExpiredRecoveryTimeDesc"),
valueType: new ToggleStringValueType(new NumericValueValidator(1, 30)),
isAvailableToHost: false);
}
protected ILocalizableString L(string name)
{
return LocalizableString.Create<AbpSaasResource>(name);
}
}

28
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Features/SaasFeatureNames.cs

@ -0,0 +1,28 @@
namespace LINGYUN.Abp.Saas.Features;
public static class SaasFeatureNames
{
public const string GroupName = "AbpSaas";
public static class Tenant
{
public const string Default = GroupName + ".Tenants";
/// <summary>
/// 资源回收策略
/// </summary>
public const string RecycleStrategy = Default + ".RecycleStrategy";
/// <summary>
/// 过期回收时长
/// </summary>
/// <remarks>
/// 当资源快过期时, 需要邮件通知对应租户管理员, 超期多久没有处理, 将回收租户资源
/// </remarks>
public const string ExpiredRecoveryTime = Default + ".ExpiredRecoveryTime";
/// <summary>
/// 过期预警天数
/// </summary>
/// <remarks>
/// 当资源还有多少天过期时, 给管理员发送提醒
/// </remarks>
public const string ExpirationReminderDays = Default + ".ExpirationReminderDays";
}
}

78
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/Tenants/TenantCacheItemInvalidator.cs

@ -1,49 +1,49 @@
using LINGYUN.Abp.Saas.Editions;
using System;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using System.Threading.Tasks;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
namespace LINGYUN.Abp.Saas.Tenants;
namespace LINGYUN.Abp.Saas.Tenants;
public class TenantCacheItemInvalidator :
IDistributedEventHandler<EntityCreatedEto<TenantEto>>,
IDistributedEventHandler<EntityDeletedEto<TenantEto>>,
IDistributedEventHandler<EntityUpdatedEto<TenantEto>>,
ILocalEventHandler<EntityChangedEventData<Tenant>>,
ITransientDependency
{
protected IDistributedCache<TenantCacheItem> Cache { get; }
public TenantCacheItemInvalidator(IDistributedCache<TenantCacheItem> cache)
{
Cache = cache;
}
public async virtual Task HandleEventAsync(EntityCreatedEto<TenantEto> eto)
IDistributedEventHandler<EntityCreatedEto<TenantEto>>,
IDistributedEventHandler<EntityDeletedEto<TenantEto>>,
IDistributedEventHandler<EntityUpdatedEto<TenantEto>>,
ILocalEventHandler<EntityChangedEventData<Tenant>>,
ITransientDependency
{
protected IDistributedCache<TenantCacheItem> Cache { get; }
public TenantCacheItemInvalidator(IDistributedCache<TenantCacheItem> cache)
{
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<TenantEto> eto)
Cache = cache;
}
public async virtual Task HandleEventAsync(EntityCreatedEto<TenantEto> eto)
{
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityDeletedEto<TenantEto> eto)
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityUpdatedEto<TenantEto> eto)
{
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityChangedEventData<Tenant> eventData)
{
await RemoveTenantCache(eventData.Entity.Id, eventData.Entity.Name);
}
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityDeletedEto<TenantEto> eto)
{
await RemoveTenantCache(eto.Entity.Id, eto.Entity.Name);
}
public async virtual Task HandleEventAsync(EntityChangedEventData<Tenant> eventData)
{
await RemoveTenantCache(eventData.Entity.Id, eventData.Entity.Name);
}
protected async virtual Task RemoveTenantCache(Guid tenantId, string tenantName = null)
{
var keys = new string[]
@ -54,7 +54,7 @@ public class TenantCacheItemInvalidator :
// 同时移除租户版本缓存
EditionCacheItem.CalculateCacheKey(tenantId)
};
};
await Cache.RemoveManyAsync(keys, considerUow: true);
}
}
}
}

3
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN.Abp.Saas.Jobs.csproj

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\Saas\Jobs\Localization\Resources\en.json" />
<None Remove="LINGYUN\Abp\Saas\Jobs\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\Saas\Jobs\Localization\Resources\en.json" />
<EmbeddedResource Include="LINGYUN\Abp\Saas\Jobs\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Emailing" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\task-management\LINGYUN.Abp.BackgroundTasks.Abstractions\LINGYUN.Abp.BackgroundTasks.Abstractions.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Saas.Domain\LINGYUN.Abp.Saas.Domain.csproj" />
</ItemGroup>
</Project>

29
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/AbpSaasJobsModule.cs

@ -0,0 +1,29 @@
using LINGYUN.Abp.BackgroundTasks;
using LINGYUN.Abp.Saas.Localization;
using Volo.Abp.Emailing;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Saas.Jobs;
[DependsOn(typeof(AbpEmailingModule))]
[DependsOn(typeof(AbpSaasDomainModule))]
[DependsOn(typeof(AbpBackgroundTasksAbstractionsModule))]
public class AbpSaasJobsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpSaasJobsModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<AbpSaasResource>()
.AddVirtualJson("/LINGYUN/Abp/Saas/Jobs/Localization/Resources");
});
}
}

12
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/LocalizableStatic.cs

@ -0,0 +1,12 @@
using LINGYUN.Abp.Saas.Localization;
using Volo.Abp.Localization;
namespace LINGYUN.Abp.Saas.Jobs;
internal static class LocalizableStatic
{
public static ILocalizableString Create(string name)
{
return LocalizableString.Create<AbpSaasResource>(name);
}
}

8
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/en.json

@ -0,0 +1,8 @@
{
"culture": "en",
"texts": {
"TenantUsageMonitoringJob": "Tenant Usage Monitoring Job",
"Saas:AdminEmail": "Admin Email",
"Saas:TenantId": "Tenant Id"
}
}

8
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/Localization/Resources/zh-Hans.json

@ -0,0 +1,8 @@
{
"culture": "zh-Hans",
"texts": {
"TenantUsageMonitoringJob": "租户使用情况监听作业",
"Saas:AdminEmail": "管理员邮件地址",
"Saas:TenantId": "租户标识"
}
}

14
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/SaasJobDefinitionProvider.cs

@ -0,0 +1,14 @@
using LINGYUN.Abp.BackgroundTasks;
namespace LINGYUN.Abp.Saas.Jobs;
public class SaasJobDefinitionProvider : JobDefinitionProvider
{
public override void Define(IJobDefinitionContext context)
{
context.Add(new JobDefinition(
"TenantUsageMonitoringJob",
typeof(TenantUsageMonitoringJob),
LocalizableStatic.Create("TenantUsageMonitoringJob"),
TenantUsageMonitoringJob.Paramters));
}
}

65
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Jobs/LINGYUN/Abp/Saas/Jobs/TenantUsageMonitoringJob.cs

@ -0,0 +1,65 @@
using LINGYUN.Abp.BackgroundTasks;
using LINGYUN.Abp.Saas.Features;
using LINGYUN.Abp.Saas.Tenants;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Emailing;
using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Timing;
namespace LINGYUN.Abp.Saas.Jobs;
public class TenantUsageMonitoringJob : IJobRunnable
{
#region Definition Paramters
public readonly static IReadOnlyList<JobDefinitionParamter> Paramters =
new List<JobDefinitionParamter>
{
new JobDefinitionParamter(PropertyAdminEmail, LocalizableStatic.Create("Saas:AdminEmail"), required: true),
new JobDefinitionParamter(PropertyTenantId, LocalizableStatic.Create("Saas:TenantId"), required: true),
};
#endregion
public const string PropertyAdminEmail = "AdminEmail";
public const string PropertyTenantId = "TenantId";
public async virtual Task ExecuteAsync(JobRunnableContext context)
{
var clock = context.GetRequiredService<IClock>();
var currentTenant = context.GetRequiredService<ICurrentTenant>();
var repository = context.GetRequiredService<ITenantRepository>();
var featureChecker = context.GetRequiredService<IFeatureChecker>();
using (currentTenant.Change(null))
{
var tenantId = context.GetJobData<Guid>(PropertyTenantId);
// TODO: 租户已删除需要取消作业运行
var tenant = await repository.GetAsync(tenantId);
if (!tenant.DisableTime.HasValue)
{
return;
}
using (currentTenant.Change(tenantId))
{
var allowExpirationDays = await featureChecker.GetAsync(SaasFeatureNames.Tenant.ExpirationReminderDays, 15);
if (tenant.DisableTime <= clock.Now.AddDays(allowExpirationDays))
{
var adminEmail = context.GetString(PropertyAdminEmail);
var emailSender = context.GetRequiredService<IEmailSender>();
// TODO: 需要使用模板发送
await emailSender.SendAsync(adminEmail, "资源超时预警", "您好, 您的平台资源已到超时预警时间, 过期资源将会被回收, 且无法恢复, 请注意及时延长使用时间或对资源备份!");
return;
}
var expiredRecoveryTime = await featureChecker.GetAsync(SaasFeatureNames.Tenant.ExpiredRecoveryTime, 15);
if (clock.Now > tenant.DisableTime && clock.Now.Subtract(TimeSpan.FromDays(expiredRecoveryTime)) <= tenant.DisableTime)
{
// 租户已过期且达到最大宽限时间, 删除租户
await repository.DeleteAsync(tenant);
}
}
}
}
}

9
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Abstractions/LINGYUN/Abp/BackgroundTasks/JobDefinition.cs

@ -16,6 +16,11 @@ public class JobDefinition
/// </summary>
public Type JobType { get; }
/// <summary>
/// 是否对客户端可见
/// Default: true.
/// </summary>
public bool IsVisibleToClients { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public ILocalizableString DisplayName { get; }
@ -32,12 +37,14 @@ public class JobDefinition
[NotNull] Type jobType,
[NotNull] ILocalizableString displayName,
[CanBeNull] IReadOnlyList<JobDefinitionParamter> paramters = null,
[CanBeNull] ILocalizableString description = null)
[CanBeNull] ILocalizableString description = null,
bool isVisibleToClients = true)
{
Name = name;
JobType = jobType;
DisplayName = displayName;
Description = description;
Paramters = paramters ?? new JobDefinitionParamter[0];
IsVisibleToClients = isVisibleToClients;
}
}

162
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/README.md

@ -1,83 +1,83 @@
# LINGYUN.Abp.BackgroundTasks
后台任务(队列)模块,Abp提供的后台作业与后台工作者不支持Cron表达式, 提供可管理的后台任务(队列)功能.
实现了**Volo.Abp.BackgroundJobs.IBackgroundJobManager**, 意味着您也能通过框架后台作业接口添加新作业.
实现了**Volo.Abp.BackgroundWorkers.IBackgroundWorkerManager**, 意味着您也能通过框架后台工作者接口添加新作业.
## 任务类别
* JobType.Once: 一次性任务, 此类型只会被执行一次, 适用于邮件通知等场景
* JobType.Period: 周期性任务, 此类型任务会根据Cron表达式来决定运行方式, 适用于报表分析等场景
* JobType.Persistent: 持续性任务, 此类型任务按照给定重复次数、重复间隔运行, 适用于接口压测等场景
## 接口说明
* [IJobPublisher](/LINGYUN/Abp/BackgroundTasks/IJobPublisher.cs): 作业发布接口, 将指定作业发布到当前节点
* [IJobDispatcher](/LINGYUN/Abp/BackgroundTasks/IJobDispatcher.cs): 作业调度接口, 将指定作业调度到指定节点
* [IJobScheduler](/LINGYUN/Abp/BackgroundTasks/IJobScheduler.cs): 调度器接口, 管理当前运行节点作业调度器
* [IJobLockProvider](/LINGYUN/Abp/BackgroundTasks/IJobLockProvider.cs): 作业锁定接口, 指定作业加锁, 防止重复运行, 锁定时长参见作业 **LockTimeOut**
* [IJobEventTrigger](/LINGYUN/Abp/BackgroundTasks/IJobEventTrigger.cs): 作业事件触发器接口, 作业运行前与运行后监听接口
* [IJobStore](/LINGYUN/Abp/BackgroundTasks/IJobStore.cs): 作业持久化接口
## 配置使用
模块按需引用
```csharp
[DependsOn(typeof(AbpBackgroundTasksModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
```csharp
public class DemoClass
{
protected IServiceProvider ServiceProvider { get; }
public DemoClass(IServiceProvider serviceProvider)
{
# LINGYUN.Abp.BackgroundTasks
后台任务(队列)模块,Abp提供的后台作业与后台工作者不支持Cron表达式, 提供可管理的后台任务(队列)功能.
实现了**Volo.Abp.BackgroundJobs.IBackgroundJobManager**, 意味着您也能通过框架后台作业接口添加新作业.
实现了**Volo.Abp.BackgroundWorkers.IBackgroundWorkerManager**, 意味着您也能通过框架后台工作者接口添加新作业.
## 任务类别
* JobType.Once: 一次性任务, 此类型只会被执行一次, 适用于邮件通知等场景
* JobType.Period: 周期性任务, 此类型任务会根据Cron表达式来决定运行方式, 适用于报表分析等场景
* JobType.Persistent: 持续性任务, 此类型任务按照给定重复次数、重复间隔运行, 适用于接口压测等场景
## 接口说明
* [IJobPublisher](/LINGYUN/Abp/BackgroundTasks/IJobPublisher.cs): 作业发布接口, 将指定作业发布到当前节点
* [IJobDispatcher](/LINGYUN/Abp/BackgroundTasks/IJobDispatcher.cs): 作业调度接口, 将指定作业调度到指定节点
* [IJobScheduler](/LINGYUN/Abp/BackgroundTasks/IJobScheduler.cs): 调度器接口, 管理当前运行节点作业调度器
* [IJobLockProvider](/LINGYUN/Abp/BackgroundTasks/IJobLockProvider.cs): 作业锁定接口, 指定作业加锁, 防止重复运行, 锁定时长参见作业 **LockTimeOut**
* [IJobEventTrigger](/LINGYUN/Abp/BackgroundTasks/IJobEventTrigger.cs): 作业事件触发器接口, 作业运行前与运行后监听接口
* [IJobStore](/LINGYUN/Abp/BackgroundTasks/IJobStore.cs): 作业持久化接口
## 配置使用
模块按需引用
```csharp
[DependsOn(typeof(AbpBackgroundTasksModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
```csharp
public class DemoClass
{
protected IServiceProvider ServiceProvider { get; }
public DemoClass(IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;
}
}
public async Task Some()
{
var scheduler = ServiceProvider.GetRequiredService<IJobScheduler>();
// 将周期性(5秒一次)任务添加到队列
await scheduler.QueueAsync(new JobInfo
{
Type = typeof(ConsoleJob).AssemblyQualifiedName,
Args = new Dictionary<string, object>(),
Name = "Test-Console-Period",
Group = "Test",
Description = "Test-Console",
Id = Guid.NewGuid(),
JobType = JobType.Period,
Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
Cron = "0/5 * * * * ? ",
TryCount = 10,
Status = JobStatus.Running,
// 定义此字段处理并发
LockTimeOut = 120,
await scheduler.QueueAsync(new JobInfo
{
Type = typeof(ConsoleJob).AssemblyQualifiedName,
Args = new Dictionary<string, object>(),
Name = "Test-Console-Period",
Group = "Test",
Description = "Test-Console",
Id = Guid.NewGuid(),
JobType = JobType.Period,
Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
Cron = "0/5 * * * * ? ",
TryCount = 10,
Status = JobStatus.Running,
// 定义此字段处理并发
LockTimeOut = 120,
});
// 将一次性任务添加到队列, 将在10(Interval)秒后被执行
await scheduler.QueueAsync(new JobInfo
{
Type = typeof(ConsoleJob).AssemblyQualifiedName,
Args = new Dictionary<string, object>(),
Name = "Test-Console-Once",
Group = "Test",
Description = "Test-Console",
Id = Guid.NewGuid(),
JobType = JobType.Once,
Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
Interval = 10,
TryCount = 10,
Status = JobStatus.Running,
await scheduler.QueueAsync(new JobInfo
{
Type = typeof(ConsoleJob).AssemblyQualifiedName,
Args = new Dictionary<string, object>(),
Name = "Test-Console-Once",
Group = "Test",
Description = "Test-Console",
Id = Guid.NewGuid(),
JobType = JobType.Once,
Priority = Volo.Abp.BackgroundJobs.BackgroundJobPriority.Low,
Interval = 10,
TryCount = 10,
Status = JobStatus.Running,
});
// 将持续性任务添加到队列, 将在10(Interval)秒后被执行, 最大执行5(MaxCount)次
@ -113,14 +113,14 @@ public class DemoClass
// 每20秒控制台输出
await backgroundWorkManager.AddAsync(ServiceProvider.GetRequiredService<ConsoleWorker>());
}
}
public class SmsJobArgs
{
}
public class SmsJobArgs
{
public string PhoneNumber { get; set; }
public string Message { get; set; }
}
}
public class SmsJob : AsyncBackgroundJob<SmsJobArgs>, ITransientDependency
{
public override Task ExecuteAsync(SmsJobArgs args)
@ -129,8 +129,8 @@ public class SmsJob : AsyncBackgroundJob<SmsJobArgs>, ITransientDependency
return Task.CompletedTask;
}
}
}
public class ConsoleWorker : AsyncPeriodicBackgroundWorkerBase, ISingletonDependency
{
public ConsoleWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory)
@ -144,5 +144,5 @@ public class ConsoleWorker : AsyncPeriodicBackgroundWorkerBase, ISingletonDepend
Console.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] - ConsoleWorker Do Wrok.");
return Task.CompletedTask;
}
}
```
}
```

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/BackgroundJobInfoAppService.cs

@ -45,6 +45,10 @@ public class BackgroundJobInfoAppService : DynamicQueryableAppService<Background
foreach (var jobDefinition in JobDefinitionManager.GetAll())
{
if (!jobDefinition.IsVisibleToClients)
{
continue;
}
var job = new BackgroundJobDefinitionDto
{
Name = jobDefinition.Name,

20
aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/appsettings.Development.json

@ -44,14 +44,14 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@ -63,13 +63,13 @@
},
"MySql": {
"TableNamePrefix": "ida",
"ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}

20
aspnet-core/services/LY.MicroService.AuthServer/appsettings.Development.json

@ -44,15 +44,15 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;",
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"OpenIddict": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "auth",
"ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=AuthServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",

2
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json

@ -57,7 +57,7 @@
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}

18
aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/appsettings.Development.json

@ -45,14 +45,14 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "ida",
"ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",

20
aspnet-core/services/LY.MicroService.IdentityServer/appsettings.Development.json

@ -44,15 +44,15 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AppPlatform": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@ -64,7 +64,7 @@
},
"MySql": {
"TableNamePrefix": "auth",
"ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",

15
aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json

@ -25,11 +25,12 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"CAP": {
"EventBus": {
@ -41,13 +42,13 @@
},
"MySql": {
"TableNamePrefix": "lta",
"ConnectionString": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}

2
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json

@ -80,7 +80,7 @@
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}

26
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json

@ -37,17 +37,17 @@
}
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
"MessageService": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
"Notifications": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456",
"TaskManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456",
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456"
"Default": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
"MessageService": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
"Notifications": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None",
"TaskManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-v70;User Id=root;Password=123456;SslMode=None",
"AbpSaas": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None",
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-v70;User Id=root;Password=123456;SslMode=None"
},
"DistributedLock": {
"IsEnabled": true,
@ -110,13 +110,13 @@
},
"MySql": {
"TableNamePrefix": "msg",
"ConnectionString": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456"
"ConnectionString": "Server=127.0.0.1;Database=Messages-v70;User Id=root;Password=123456;SslMode=None"
},
"RabbitMQ": {
"HostName": "127.0.0.1",
"Port": 5672,
"UserName": "admin",
"Password": "admin",
"Password": "123456",
"ExchangeName": "LINGYUN.Abp.Application",
"VirtualHost": "/"
}

4
starter/01.create database.cmd

@ -0,0 +1,4 @@
@echo off
cd ..\aspnet-core
create-database.bat

0
starter/01.migrate-db.cmd → starter/02.migrate-db.cmd

Loading…
Cancel
Save