| | | 1 | | using CShells.Features; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using Elsa.Labels.Contracts; |
| | | 4 | | using Elsa.Labels.Entities; |
| | | 5 | | using Elsa.Labels.Services; |
| | | 6 | | using JetBrains.Annotations; |
| | | 7 | | using Microsoft.Extensions.DependencyInjection; |
| | | 8 | | |
| | | 9 | | namespace Elsa.Labels.ShellFeatures; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// Enables functionality to tag workflows with labels. |
| | | 13 | | /// </summary> |
| | | 14 | | [ShellFeature( |
| | | 15 | | DisplayName = "Labels", |
| | | 16 | | Description = "Enables functionality to tag workflows with labels", |
| | | 17 | | DependsOn = ["Mediator"])] |
| | | 18 | | [UsedImplicitly] |
| | | 19 | | public class LabelsFeature : IShellFeature |
| | | 20 | | { |
| | | 21 | | /// <summary> |
| | | 22 | | /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>. |
| | | 23 | | /// </summary> |
| | 0 | 24 | | public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>. |
| | | 28 | | /// </summary> |
| | 0 | 29 | | public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G |
| | | 30 | | |
| | | 31 | | public void ConfigureServices(IServiceCollection services) |
| | | 32 | | { |
| | 0 | 33 | | services |
| | 0 | 34 | | .AddMemoryStore<Label, InMemoryLabelStore>() |
| | 0 | 35 | | .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>() |
| | 0 | 36 | | .AddScoped(LabelStore) |
| | 0 | 37 | | .AddScoped(WorkflowDefinitionLabelStore); |
| | | 38 | | |
| | 0 | 39 | | services.AddNotificationHandlersFrom(GetType()); |
| | 0 | 40 | | } |
| | | 41 | | } |
| | | 42 | | |