From 3b876820e0ecfb07b8000003ffb77ed1b3d4c81b Mon Sep 17 00:00:00 2001 From: feijie Date: Sun, 8 Dec 2024 22:50:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(elsa):=20=E6=B7=BB=E5=8A=A0=E5=AF=B9=20SQL?= =?UTF-8?q?=20Server=20=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Packages.props | 2 ++ aspnet-core/LINGYUN.MicroService.All.sln | 7 +++++ .../LINGYUN.MicroService.SingleProject.sln | 7 +++++ aspnet-core/LINGYUN.MicroService.Workflow.sln | 7 +++++ .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 +++++++++++++++++++ ....Elsa.EntityFrameworkCore.SqlServer.csproj | 27 +++++++++++++++++ ...pElsaEntityFrameworkCoreSqlServerModule.cs | 29 ++++++++++++++++++ .../SqlServer/PersistenceStartup.cs | 15 ++++++++++ .../SqlServer/WebhooksStartup.cs | 17 +++++++++++ .../SqlServer/WorkflowSettingsStartup.cs | 17 +++++++++++ 11 files changed, 161 insertions(+) create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xml create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xsd create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/AbpElsaEntityFrameworkCoreSqlServerModule.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/PersistenceStartup.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WebhooksStartup.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WorkflowSettingsStartup.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index e246538a0..8ab2ed845 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -174,6 +174,8 @@ + + diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index 987b1916c..7796988bc 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -768,6 +768,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.I EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql.csproj", "{CD70B78F-C15B-49B6-B0EA-570A9D18D7C8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj", "{416C0C27-4E3C-4919-857F-14DA41D84CFA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1970,6 +1972,10 @@ Global {CD70B78F-C15B-49B6-B0EA-570A9D18D7C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD70B78F-C15B-49B6-B0EA-570A9D18D7C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD70B78F-C15B-49B6-B0EA-570A9D18D7C8}.Release|Any CPU.Build.0 = Release|Any CPU + {416C0C27-4E3C-4919-857F-14DA41D84CFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {416C0C27-4E3C-4919-857F-14DA41D84CFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {416C0C27-4E3C-4919-857F-14DA41D84CFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {416C0C27-4E3C-4919-857F-14DA41D84CFA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2341,6 +2347,7 @@ Global {76DDE71D-00BD-4BC8-AEA2-31209E2B7E05} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {267933BD-BFB8-4906-BA39-DF193B2FD558} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {CD70B78F-C15B-49B6-B0EA-570A9D18D7C8} = {0A00FAF9-A96B-4BF5-8D42-15C8678F70F3} + {416C0C27-4E3C-4919-857F-14DA41D84CFA} = {0A00FAF9-A96B-4BF5-8D42-15C8678F70F3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/LINGYUN.MicroService.SingleProject.sln b/aspnet-core/LINGYUN.MicroService.SingleProject.sln index a1157688f..8460fcec6 100644 --- a/aspnet-core/LINGYUN.MicroService.SingleProject.sln +++ b/aspnet-core/LINGYUN.MicroService.SingleProject.sln @@ -604,6 +604,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.I EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql.csproj", "{8D0C8993-580A-4585-BE3B-87895C76FC89}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj", "{AA742577-63B0-4188-AA36-AC6E0ED99BB6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1590,6 +1592,10 @@ Global {8D0C8993-580A-4585-BE3B-87895C76FC89}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D0C8993-580A-4585-BE3B-87895C76FC89}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D0C8993-580A-4585-BE3B-87895C76FC89}.Release|Any CPU.Build.0 = Release|Any CPU + {AA742577-63B0-4188-AA36-AC6E0ED99BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA742577-63B0-4188-AA36-AC6E0ED99BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA742577-63B0-4188-AA36-AC6E0ED99BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA742577-63B0-4188-AA36-AC6E0ED99BB6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1883,6 +1889,7 @@ Global {9AE3E97E-8846-4315-9546-FF97E97FD49F} = {3AD66E47-B667-40D1-AE61-F5EC186241F7} {BC7A8662-4313-4F1D-B267-9B1B69444CD3} = {3AD66E47-B667-40D1-AE61-F5EC186241F7} {8D0C8993-580A-4585-BE3B-87895C76FC89} = {07DFEB1E-ED92-4E97-A801-FAB2D70F4F35} + {AA742577-63B0-4188-AA36-AC6E0ED99BB6} = {07DFEB1E-ED92-4E97-A801-FAB2D70F4F35} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1} diff --git a/aspnet-core/LINGYUN.MicroService.Workflow.sln b/aspnet-core/LINGYUN.MicroService.Workflow.sln index ed05c7a64..be7c2023c 100644 --- a/aspnet-core/LINGYUN.MicroService.Workflow.sln +++ b/aspnet-core/LINGYUN.MicroService.Workflow.sln @@ -173,6 +173,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.Sessio EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql\LINGYUN.Abp.Elsa.EntityFrameworkCore.PostgreSql.csproj", "{D56851BB-557E-4CF9-B724-8E607EEE9D07}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer", "modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer\LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj", "{22BB3760-8DA1-4714-ADB7-1585A4EB8496}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -463,6 +465,10 @@ Global {D56851BB-557E-4CF9-B724-8E607EEE9D07}.Debug|Any CPU.Build.0 = Debug|Any CPU {D56851BB-557E-4CF9-B724-8E607EEE9D07}.Release|Any CPU.ActiveCfg = Release|Any CPU {D56851BB-557E-4CF9-B724-8E607EEE9D07}.Release|Any CPU.Build.0 = Release|Any CPU + {22BB3760-8DA1-4714-ADB7-1585A4EB8496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22BB3760-8DA1-4714-ADB7-1585A4EB8496}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22BB3760-8DA1-4714-ADB7-1585A4EB8496}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22BB3760-8DA1-4714-ADB7-1585A4EB8496}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -541,6 +547,7 @@ Global {6ECF678D-6F3A-4084-8538-A86C1D67C703} = {9C73D4E6-4408-4717-B51C-63C20321D4DA} {9FB5E943-7F6F-4281-9C00-E76284B4F1F3} = {9C73D4E6-4408-4717-B51C-63C20321D4DA} {D56851BB-557E-4CF9-B724-8E607EEE9D07} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC} + {22BB3760-8DA1-4714-ADB7-1585A4EB8496} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6BB7A5DE-DA12-44DC-BC9B-0F6CA524346F} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xml b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xml new file mode 100644 index 000000000..5d6962159 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xsd b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj new file mode 100644 index 000000000..a939d8694 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer.csproj @@ -0,0 +1,27 @@ + + + + + + + net8.0 + LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer + LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer + false + false + false + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/AbpElsaEntityFrameworkCoreSqlServerModule.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/AbpElsaEntityFrameworkCoreSqlServerModule.cs new file mode 100644 index 000000000..915ca3c75 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/AbpElsaEntityFrameworkCoreSqlServerModule.cs @@ -0,0 +1,29 @@ +using Elsa; +using Elsa.Options; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore.SqlServer; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer; + +[DependsOn( + typeof(AbpElsaEntityFrameworkCoreModule), + typeof(AbpEntityFrameworkCoreSqlServerModule))] +public class AbpElsaEntityFrameworkCoreSqlServerModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + var startups = new[] + { + typeof(PersistenceStartup), + typeof(WebhooksStartup), + typeof(WorkflowSettingsStartup), + }; + + PreConfigure(elsa => + { + elsa.AddFeatures(startups, configuration); + }); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/PersistenceStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/PersistenceStartup.cs new file mode 100644 index 000000000..41211dbc4 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/PersistenceStartup.cs @@ -0,0 +1,15 @@ +using Elsa.Attributes; +using Microsoft.EntityFrameworkCore; + +namespace LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer; + +[Feature("DefaultPersistence:EntityFrameworkCore:SqlServer")] +public class PersistenceStartup : PersistenceStartupBase +{ + protected override string ProviderName => "SqlServer"; + + protected override void Configure(DbContextOptionsBuilder options, string connectionString) + { + options.UseSqlServer(connectionString); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WebhooksStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WebhooksStartup.cs new file mode 100644 index 000000000..c9fe588fc --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WebhooksStartup.cs @@ -0,0 +1,17 @@ +using Elsa.Attributes; +using Microsoft.EntityFrameworkCore; + +namespace LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer; + +[Feature("Webhooks:EntityFrameworkCore:SqlServer")] +public class WebhooksStartup : WebhooksStartupBase +{ + protected override string ProviderName => "SqlServer"; + + protected override void Configure(DbContextOptionsBuilder options, string connectionString) + { + options.UseSqlServer( + connectionString, + x => x.MigrationsHistoryTable("__EFMigrationsHistory_Webhooks")); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WorkflowSettingsStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WorkflowSettingsStartup.cs new file mode 100644 index 000000000..5160258e6 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer/LINGYUN/Abp/Elsa/EntityFrameworkCore/SqlServer/WorkflowSettingsStartup.cs @@ -0,0 +1,17 @@ +using Elsa.Attributes; +using Microsoft.EntityFrameworkCore; + +namespace LINGYUN.Abp.Elsa.EntityFrameworkCore.SqlServer; + +[Feature("WorkflowSettings:EntityFrameworkCore:SqlServer")] +public class WorkflowSettingsStartup : WorkflowSettingsStartupBase +{ + protected override string ProviderName => "SqlServer"; + + protected override void Configure(DbContextOptionsBuilder options, string connectionString) + { + options.UseSqlServer( + connectionString, + x => x.MigrationsHistoryTable("__EFMigrationsHistory_WorkflowSettings")); + } +}