Moved KeyValueStore to separate feature
This commit is contained in:
parent
3fa7a06310
commit
78bea4be7f
7
Elsa.sln
7
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}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <inheritdoc />
|
||||
public override void Configure()
|
||||
{
|
||||
Module.Configure<KeyValueFeature>(feature =>
|
||||
{
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<DapperKeyValueStore>();
|
||||
});
|
||||
Module.Configure<WorkflowRuntimeFeature>(feature =>
|
||||
{
|
||||
feature.TriggerStore = sp => sp.GetRequiredService<DapperTriggerStore>();
|
||||
|
|
@ -31,7 +36,6 @@ public class DapperWorkflowRuntimePersistenceFeature : FeatureBase
|
|||
feature.WorkflowInboxStore = sp => sp.GetRequiredService<DapperWorkflowInboxMessageStore>();
|
||||
feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService<DapperWorkflowExecutionLogStore>();
|
||||
feature.ActivityExecutionLogStore = sp => sp.GetRequiredService<DapperActivityExecutionRecordStore>();
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<DapperKeyValueStore>();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Elsa.KeyValues.Entities;
|
||||
using Elsa.Workflows.Runtime.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Elsa.EntityFrameworkCore.Common;
|
||||
using Elsa.KeyValues.Entities;
|
||||
using Elsa.Workflows.Runtime.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Ru
|
|||
/// <inheritdoc />
|
||||
public override void Configure()
|
||||
{
|
||||
Module.Configure<KeyValueFeature>(feature =>
|
||||
{
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<EFCoreKeyValueStore>();
|
||||
});
|
||||
Module.Configure<WorkflowRuntimeFeature>(feature =>
|
||||
{
|
||||
feature.TriggerStore = sp => sp.GetRequiredService<EFCoreTriggerStore>();
|
||||
|
|
@ -28,7 +34,6 @@ public class EFCoreWorkflowRuntimePersistenceFeature : PersistenceFeatureBase<Ru
|
|||
feature.WorkflowInboxStore = sp => sp.GetRequiredService<EFCoreWorkflowInboxMessageStore>();
|
||||
feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService<EFCoreWorkflowExecutionLogStore>();
|
||||
feature.ActivityExecutionLogStore = sp => sp.GetRequiredService<EFCoreActivityExecutionStore>();
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<EFCoreKeyValueStore>();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Copyright>2024</Copyright>
|
||||
<PackageProjectUrl>https://github.com/elsa-workflows/elsa-core</PackageProjectUrl>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<RepositoryUrl>https://github.com/elsa-workflows/elsa-core</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>
|
||||
Provides hosting management functionality.
|
||||
|
|
@ -19,10 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.Workflows.Runtime\Elsa.Workflows.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.KeyValues\Elsa.KeyValues.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Runtime\Elsa.Workflows.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Store that holds key value entities not fit to store in specific stores.
|
||||
14
src/modules/Elsa.KeyValues/Elsa.KeyValues.csproj
Normal file
14
src/modules/Elsa.KeyValues/Elsa.KeyValues.csproj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>
|
||||
Provides a store for holding key value records.
|
||||
</Description>
|
||||
<PackageTags>elsa module keyvalue</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Elsa.Features\Elsa.Features.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Common\Elsa.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Elsa.Workflows.Runtime.Entities;
|
||||
namespace Elsa.KeyValues.Entities;
|
||||
|
||||
public class SerializedKeyValuePair
|
||||
{
|
||||
30
src/modules/Elsa.KeyValues/Features/KeyValueFeature.cs
Normal file
30
src/modules/Elsa.KeyValues/Features/KeyValueFeature.cs
Normal file
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Installs and configures instance management features.
|
||||
/// </summary>
|
||||
public class KeyValueFeature : FeatureBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public KeyValueFeature(IModule module) : base(module)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A factory that instantiates an <see cref="IKeyValueStore"/>.
|
||||
/// </summary>
|
||||
public Func<IServiceProvider, IKeyValueStore> KeyValueStore { get; set; } = sp => ActivatorUtilities.CreateInstance<MemoryKeyValueStore>(sp);
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Apply()
|
||||
{
|
||||
Services.AddScoped(KeyValueStore);
|
||||
}
|
||||
}
|
||||
3
src/modules/Elsa.KeyValues/FodyWeavers.xml
Normal file
3
src/modules/Elsa.KeyValues/FodyWeavers.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -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
|
||||
{
|
||||
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Stores key value records in memory.
|
||||
|
|
@ -13,7 +13,7 @@ public class MemoryKeyValueStore : IKeyValueStore
|
|||
private readonly MemoryStore<SerializedKeyValuePair> _store;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemoryActivityExecutionStore"/> class.
|
||||
/// Initializes a new instance of the <see cref="MemoryKeyValueStore"/> class.
|
||||
/// </summary>
|
||||
public MemoryKeyValueStore(MemoryStore<SerializedKeyValuePair> store)
|
||||
{
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
using Elsa.KeyValues.Entities;
|
||||
using Elsa.MongoDb.Helpers;
|
||||
using Elsa.Workflows.Runtime.Entities;
|
||||
using Elsa.Workflows.State;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <inheritdoc />
|
||||
public override void Configure()
|
||||
{
|
||||
Module.Configure<KeyValueFeature>(feature =>
|
||||
{
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<MongoKeyValueStore>();
|
||||
});
|
||||
Module.Configure<WorkflowRuntimeFeature>(feature =>
|
||||
{
|
||||
feature.TriggerStore = sp => sp.GetRequiredService<MongoTriggerStore>();
|
||||
|
|
@ -29,7 +34,6 @@ public class MongoWorkflowRuntimePersistenceFeature : PersistenceFeatureBase
|
|||
feature.WorkflowExecutionLogStore = sp => sp.GetRequiredService<MongoWorkflowExecutionLogStore>();
|
||||
feature.ActivityExecutionLogStore = sp => sp.GetRequiredService<MongoActivityExecutionLogStore>();
|
||||
feature.WorkflowInboxStore = sp => sp.GetRequiredService<MongoWorkflowInboxMessageStore>();
|
||||
feature.KeyValueStore = sp => sp.GetRequiredService<MongoKeyValueStore>();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.KeyValues\Elsa.KeyValues.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Core\Elsa.Workflows.Core.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Management\Elsa.Workflows.Management.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -78,11 +78,6 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
/// A factory that instantiates an <see cref="IWorkflowInboxMessageStore"/>.
|
||||
/// </summary>
|
||||
public Func<IServiceProvider, IWorkflowInboxMessageStore> WorkflowInboxStore { get; set; } = sp => sp.GetRequiredService<MemoryWorkflowInboxMessageStore>();
|
||||
|
||||
/// <summary>
|
||||
/// A factory that instantiates an <see cref="IKeyValueStore"/>.
|
||||
/// </summary>
|
||||
public Func<IServiceProvider, IKeyValueStore> KeyValueStore { get; set; } = sp => ActivatorUtilities.CreateInstance<MemoryKeyValueStore>(sp);
|
||||
|
||||
/// <summary>
|
||||
/// A factory that instantiates an <see cref="IWorkflowExecutionContextStore"/>.
|
||||
|
|
@ -175,7 +170,6 @@ public class WorkflowRuntimeFeature : FeatureBase
|
|||
.AddScoped(WorkflowExecutionLogStore)
|
||||
.AddScoped(ActivityExecutionLogStore)
|
||||
.AddScoped(WorkflowInboxStore)
|
||||
.AddScoped(KeyValueStore)
|
||||
.AddScoped(WorkflowExecutionContextStore)
|
||||
.AddSingleton(RunTaskDispatcher)
|
||||
.AddSingleton(BackgroundActivityScheduler)
|
||||
|
|
|
|||
Loading…
Reference in a new issue