diff --git a/Elsa.sln b/Elsa.sln index 4e084ca6b..5ab373fb7 100644 --- a/Elsa.sln +++ b/Elsa.sln @@ -318,6 +318,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hosting", "hosting", "{A516 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Hosting.Management", "src\modules\Elsa.Hosting.Management\Elsa.Hosting.Management.csproj", "{BBCE36D1-6767-4ED1-B3E8-84D2567A962A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.KeyValues", "src\modules\Elsa.KeyValues\Elsa.KeyValues.csproj", "{73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -790,6 +792,10 @@ Global {BBCE36D1-6767-4ED1-B3E8-84D2567A962A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BBCE36D1-6767-4ED1-B3E8-84D2567A962A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BBCE36D1-6767-4ED1-B3E8-84D2567A962A}.Release|Any CPU.Build.0 = Release|Any CPU + {73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -931,6 +937,7 @@ Global {832D6FF5-16D3-41D1-8FDD-D9BEC26BDA6A} = {56C2FFB8-EA54-45B5-A095-4A78142EB4B5} {A516931E-EDBB-4FC3-BB94-1BB824D5BC61} = {5BA4A8FA-F7F4-45B3-AEC8-8886D35AAC79} {BBCE36D1-6767-4ED1-B3E8-84D2567A962A} = {A516931E-EDBB-4FC3-BB94-1BB824D5BC61} + {73BBB1E3-AEEC-44E8-83D7-6DD9CD687FE3} = {5BA4A8FA-F7F4-45B3-AEC8-8886D35AAC79} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D4B5CEAA-7D70-4FCB-A68E-B03FBE5E0E5E} diff --git a/src/modules/Elsa.Dapper/Modules/Runtime/Features/DapperWorkflowRuntimePersistenceFeature.cs b/src/modules/Elsa.Dapper/Modules/Runtime/Features/DapperWorkflowRuntimePersistenceFeature.cs index 43888dd14..d75e9acfb 100644 --- a/src/modules/Elsa.Dapper/Modules/Runtime/Features/DapperWorkflowRuntimePersistenceFeature.cs +++ b/src/modules/Elsa.Dapper/Modules/Runtime/Features/DapperWorkflowRuntimePersistenceFeature.cs @@ -3,6 +3,7 @@ using Elsa.Dapper.Modules.Runtime.Stores; using Elsa.Features.Abstractions; using Elsa.Features.Attributes; using Elsa.Features.Services; +using Elsa.KeyValues.Features; using Elsa.Workflows.Runtime.Features; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; @@ -24,6 +25,10 @@ public class DapperWorkflowRuntimePersistenceFeature : FeatureBase /// public override void Configure() { + Module.Configure(feature => + { + feature.KeyValueStore = sp => sp.GetRequiredService(); + }); Module.Configure(feature => { feature.TriggerStore = sp => sp.GetRequiredService(); @@ -31,7 +36,6 @@ public class DapperWorkflowRuntimePersistenceFeature : FeatureBase feature.WorkflowInboxStore = sp => sp.GetRequiredService(); feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService(); feature.ActivityExecutionLogStore = sp => sp.GetRequiredService(); - feature.KeyValueStore = sp => sp.GetRequiredService(); }); } diff --git a/src/modules/Elsa.Dapper/Modules/Runtime/Stores/KeyValueStore.cs b/src/modules/Elsa.Dapper/Modules/Runtime/Stores/KeyValueStore.cs index d7908d124..958aca64b 100644 --- a/src/modules/Elsa.Dapper/Modules/Runtime/Stores/KeyValueStore.cs +++ b/src/modules/Elsa.Dapper/Modules/Runtime/Stores/KeyValueStore.cs @@ -3,9 +3,9 @@ using Elsa.Dapper.Extensions; using Elsa.Dapper.Models; using Elsa.Dapper.Modules.Runtime.Records; using Elsa.Dapper.Services; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Entities; -using Elsa.Workflows.Runtime.Models; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Models; namespace Elsa.Dapper.Modules.Runtime.Stores; diff --git a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/Configurations.cs b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/Configurations.cs index f0385e439..77495703f 100644 --- a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/Configurations.cs +++ b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/Configurations.cs @@ -1,3 +1,4 @@ +using Elsa.KeyValues.Entities; using Elsa.Workflows.Runtime.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/DbContext.cs b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/DbContext.cs index 3e229cae7..45b4c4f8b 100644 --- a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/DbContext.cs +++ b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/DbContext.cs @@ -1,4 +1,5 @@ using Elsa.EntityFrameworkCore.Common; +using Elsa.KeyValues.Entities; using Elsa.Workflows.Runtime.Entities; using Microsoft.EntityFrameworkCore; diff --git a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/KeyValueStore.cs b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/KeyValueStore.cs index 22a704dbe..8d8479af2 100644 --- a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/KeyValueStore.cs +++ b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/KeyValueStore.cs @@ -1,7 +1,7 @@ using Elsa.EntityFrameworkCore.Common; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Entities; -using Elsa.Workflows.Runtime.Models; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Models; namespace Elsa.EntityFrameworkCore.Modules.Runtime; diff --git a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs index 0543af3c4..3cf255f7e 100644 --- a/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs +++ b/src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs @@ -1,6 +1,8 @@ using Elsa.EntityFrameworkCore.Common; using Elsa.Features.Attributes; using Elsa.Features.Services; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Features; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Features; using Microsoft.Extensions.DependencyInjection; @@ -21,6 +23,10 @@ public class EFCoreWorkflowRuntimePersistenceFeature : PersistenceFeatureBase public override void Configure() { + Module.Configure(feature => + { + feature.KeyValueStore = sp => sp.GetRequiredService(); + }); Module.Configure(feature => { feature.TriggerStore = sp => sp.GetRequiredService(); @@ -28,7 +34,6 @@ public class EFCoreWorkflowRuntimePersistenceFeature : PersistenceFeatureBase sp.GetRequiredService(); feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService(); feature.ActivityExecutionLogStore = sp => sp.GetRequiredService(); - feature.KeyValueStore = sp => sp.GetRequiredService(); }); } diff --git a/src/modules/Elsa.Hosting.Management/Elsa.Hosting.Management.csproj b/src/modules/Elsa.Hosting.Management/Elsa.Hosting.Management.csproj index 38c898e33..f0a4287a6 100644 --- a/src/modules/Elsa.Hosting.Management/Elsa.Hosting.Management.csproj +++ b/src/modules/Elsa.Hosting.Management/Elsa.Hosting.Management.csproj @@ -1,16 +1,5 @@ - - enable - enable - net6.0;net7.0;net8.0 - latest - 2024 - https://github.com/elsa-workflows/elsa-core - icon.png - https://github.com/elsa-workflows/elsa-core - - Provides hosting management functionality. @@ -19,10 +8,7 @@ - - - - + diff --git a/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatMonitorService.cs b/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatMonitorService.cs index ff5971042..1927184f9 100644 --- a/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatMonitorService.cs +++ b/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatMonitorService.cs @@ -1,12 +1,12 @@ +using Elsa.Common.Contracts; using Elsa.Hosting.Management.Notifications; using Elsa.Hosting.Management.Options; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Models; using Elsa.Mediator.Contracts; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Models; using Medallion.Threading; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Internal; using Microsoft.Extensions.Options; namespace Elsa.Hosting.Management.HostedServices; diff --git a/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatService.cs b/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatService.cs index 96246e762..2c9e2c452 100644 --- a/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatService.cs +++ b/src/modules/Elsa.Hosting.Management/HostedServices/InstanceHeartbeatService.cs @@ -1,7 +1,7 @@ using Elsa.Hosting.Management.Contracts; using Elsa.Hosting.Management.Options; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Entities; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Entities; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; diff --git a/src/modules/Elsa.Workflows.Runtime/Contracts/IKeyValueStore.cs b/src/modules/Elsa.KeyValues/Contracts/IKeyValueStore.cs similarity index 86% rename from src/modules/Elsa.Workflows.Runtime/Contracts/IKeyValueStore.cs rename to src/modules/Elsa.KeyValues/Contracts/IKeyValueStore.cs index 82e81976d..8b55046ad 100644 --- a/src/modules/Elsa.Workflows.Runtime/Contracts/IKeyValueStore.cs +++ b/src/modules/Elsa.KeyValues/Contracts/IKeyValueStore.cs @@ -1,8 +1,7 @@ -using System.Linq.Expressions; -using Elsa.Workflows.Runtime.Entities; -using Elsa.Workflows.Runtime.Models; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Models; -namespace Elsa.Workflows.Runtime.Contracts; +namespace Elsa.KeyValues.Contracts; /// /// Store that holds key value entities not fit to store in specific stores. diff --git a/src/modules/Elsa.KeyValues/Elsa.KeyValues.csproj b/src/modules/Elsa.KeyValues/Elsa.KeyValues.csproj new file mode 100644 index 000000000..af8f2a119 --- /dev/null +++ b/src/modules/Elsa.KeyValues/Elsa.KeyValues.csproj @@ -0,0 +1,14 @@ + + + + + Provides a store for holding key value records. + + elsa module keyvalue + + + + + + + diff --git a/src/modules/Elsa.Workflows.Runtime/Entities/SerializedKeyValuePair.cs b/src/modules/Elsa.KeyValues/Entities/SerializedKeyValuePair.cs similarity index 74% rename from src/modules/Elsa.Workflows.Runtime/Entities/SerializedKeyValuePair.cs rename to src/modules/Elsa.KeyValues/Entities/SerializedKeyValuePair.cs index 999100f23..ecb226072 100644 --- a/src/modules/Elsa.Workflows.Runtime/Entities/SerializedKeyValuePair.cs +++ b/src/modules/Elsa.KeyValues/Entities/SerializedKeyValuePair.cs @@ -1,4 +1,4 @@ -namespace Elsa.Workflows.Runtime.Entities; +namespace Elsa.KeyValues.Entities; public class SerializedKeyValuePair { diff --git a/src/modules/Elsa.KeyValues/Features/KeyValueFeature.cs b/src/modules/Elsa.KeyValues/Features/KeyValueFeature.cs new file mode 100644 index 000000000..4b346467d --- /dev/null +++ b/src/modules/Elsa.KeyValues/Features/KeyValueFeature.cs @@ -0,0 +1,30 @@ +using Elsa.Features.Abstractions; +using Elsa.Features.Services; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Stores; +using Microsoft.Extensions.DependencyInjection; + +namespace Elsa.KeyValues.Features; + +/// +/// Installs and configures instance management features. +/// +public class KeyValueFeature : FeatureBase +{ + /// + public KeyValueFeature(IModule module) : base(module) + { + } + + /// + /// A factory that instantiates an . + /// + public Func KeyValueStore { get; set; } = sp => ActivatorUtilities.CreateInstance(sp); + + + /// + public override void Apply() + { + Services.AddScoped(KeyValueStore); + } +} \ No newline at end of file diff --git a/src/modules/Elsa.KeyValues/FodyWeavers.xml b/src/modules/Elsa.KeyValues/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/src/modules/Elsa.KeyValues/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/modules/Elsa.Workflows.Runtime/Models/KeyValueFilter.cs b/src/modules/Elsa.KeyValues/Models/KeyValueFilter.cs similarity index 93% rename from src/modules/Elsa.Workflows.Runtime/Models/KeyValueFilter.cs rename to src/modules/Elsa.KeyValues/Models/KeyValueFilter.cs index cac333501..1096278d6 100644 --- a/src/modules/Elsa.Workflows.Runtime/Models/KeyValueFilter.cs +++ b/src/modules/Elsa.KeyValues/Models/KeyValueFilter.cs @@ -1,6 +1,6 @@ -using Elsa.Workflows.Runtime.Entities; +using Elsa.KeyValues.Entities; -namespace Elsa.Workflows.Runtime.Models; +namespace Elsa.KeyValues.Models; public class KeyValueFilter { diff --git a/src/modules/Elsa.Workflows.Runtime/Stores/MemoryKeyValueStore.cs b/src/modules/Elsa.KeyValues/Stores/MemoryKeyValueStore.cs similarity index 83% rename from src/modules/Elsa.Workflows.Runtime/Stores/MemoryKeyValueStore.cs rename to src/modules/Elsa.KeyValues/Stores/MemoryKeyValueStore.cs index 6e17260e0..ebb9ac061 100644 --- a/src/modules/Elsa.Workflows.Runtime/Stores/MemoryKeyValueStore.cs +++ b/src/modules/Elsa.KeyValues/Stores/MemoryKeyValueStore.cs @@ -1,9 +1,9 @@ using Elsa.Common.Services; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Entities; -using Elsa.Workflows.Runtime.Models; +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Models; -namespace Elsa.Workflows.Runtime.Stores; +namespace Elsa.KeyValues.Stores; /// /// Stores key value records in memory. @@ -13,7 +13,7 @@ public class MemoryKeyValueStore : IKeyValueStore private readonly MemoryStore _store; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public MemoryKeyValueStore(MemoryStore store) { diff --git a/src/modules/Elsa.MongoDb/Modules/Runtime/CreateIndices.cs b/src/modules/Elsa.MongoDb/Modules/Runtime/CreateIndices.cs index 167f20d7b..945254775 100644 --- a/src/modules/Elsa.MongoDb/Modules/Runtime/CreateIndices.cs +++ b/src/modules/Elsa.MongoDb/Modules/Runtime/CreateIndices.cs @@ -1,3 +1,4 @@ +using Elsa.KeyValues.Entities; using Elsa.MongoDb.Helpers; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.State; diff --git a/src/modules/Elsa.MongoDb/Modules/Runtime/KeyValueStore.cs b/src/modules/Elsa.MongoDb/Modules/Runtime/KeyValueStore.cs index 62f4901ab..abea6f37c 100644 --- a/src/modules/Elsa.MongoDb/Modules/Runtime/KeyValueStore.cs +++ b/src/modules/Elsa.MongoDb/Modules/Runtime/KeyValueStore.cs @@ -1,7 +1,7 @@ +using Elsa.KeyValues.Contracts; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Models; using Elsa.MongoDb.Common; -using Elsa.Workflows.Runtime.Contracts; -using Elsa.Workflows.Runtime.Entities; -using Elsa.Workflows.Runtime.Models; using MongoDB.Driver.Linq; using Open.Linq.AsyncExtensions; diff --git a/src/modules/Elsa.MongoDb/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs b/src/modules/Elsa.MongoDb/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs index 671b94393..c1919bd06 100644 --- a/src/modules/Elsa.MongoDb/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs +++ b/src/modules/Elsa.MongoDb/Modules/Runtime/WorkflowRuntimePersistenceFeature.cs @@ -1,6 +1,7 @@ -using Elsa.Common.Entities; using Elsa.Features.Attributes; using Elsa.Features.Services; +using Elsa.KeyValues.Entities; +using Elsa.KeyValues.Features; using Elsa.MongoDb.Common; using Elsa.Workflows.Runtime.Entities; using Elsa.Workflows.Runtime.Features; @@ -22,6 +23,10 @@ public class MongoWorkflowRuntimePersistenceFeature : PersistenceFeatureBase /// public override void Configure() { + Module.Configure(feature => + { + feature.KeyValueStore = sp => sp.GetRequiredService(); + }); Module.Configure(feature => { feature.TriggerStore = sp => sp.GetRequiredService(); @@ -29,7 +34,6 @@ public class MongoWorkflowRuntimePersistenceFeature : PersistenceFeatureBase feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService(); feature.ActivityExecutionLogStore = sp => sp.GetRequiredService(); feature.WorkflowInboxStore = sp => sp.GetRequiredService(); - feature.KeyValueStore = sp => sp.GetRequiredService(); }); } diff --git a/src/modules/Elsa.Workflows.Runtime/Elsa.Workflows.Runtime.csproj b/src/modules/Elsa.Workflows.Runtime/Elsa.Workflows.Runtime.csproj index cacb46291..f9306e769 100644 --- a/src/modules/Elsa.Workflows.Runtime/Elsa.Workflows.Runtime.csproj +++ b/src/modules/Elsa.Workflows.Runtime/Elsa.Workflows.Runtime.csproj @@ -15,6 +15,7 @@ + diff --git a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs index 961f7cb9e..74a1c7124 100644 --- a/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs +++ b/src/modules/Elsa.Workflows.Runtime/Features/WorkflowRuntimeFeature.cs @@ -78,11 +78,6 @@ public class WorkflowRuntimeFeature : FeatureBase /// A factory that instantiates an . /// public Func WorkflowInboxStore { get; set; } = sp => sp.GetRequiredService(); - - /// - /// A factory that instantiates an . - /// - public Func KeyValueStore { get; set; } = sp => ActivatorUtilities.CreateInstance(sp); /// /// A factory that instantiates an . @@ -175,7 +170,6 @@ public class WorkflowRuntimeFeature : FeatureBase .AddScoped(WorkflowExecutionLogStore) .AddScoped(ActivityExecutionLogStore) .AddScoped(WorkflowInboxStore) - .AddScoped(KeyValueStore) .AddScoped(WorkflowExecutionContextStore) .AddSingleton(RunTaskDispatcher) .AddSingleton(BackgroundActivityScheduler)