| | | 1 | | using Elsa.Common.Features; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using Elsa.Features.Abstractions; |
| | | 4 | | using Elsa.Features.Attributes; |
| | | 5 | | using Elsa.Features.Services; |
| | | 6 | | using Elsa.Labels.Contracts; |
| | | 7 | | using Elsa.Labels.Entities; |
| | | 8 | | using Elsa.Labels.Services; |
| | | 9 | | using Microsoft.Extensions.DependencyInjection; |
| | | 10 | | |
| | | 11 | | namespace Elsa.Labels.Features; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Enables functionality to tag workflows with labels. |
| | | 15 | | /// </summary> |
| | | 16 | | [DependsOn(typeof(MediatorFeature))] |
| | | 17 | | public class LabelsFeature : FeatureBase |
| | | 18 | | { |
| | | 19 | | /// <inheritdoc /> |
| | 0 | 20 | | public LabelsFeature(IModule module) : base(module) |
| | | 21 | | { |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>. |
| | | 26 | | /// </summary> |
| | 0 | 27 | | public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>. |
| | | 31 | | /// </summary> |
| | 0 | 32 | | public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G |
| | | 33 | | |
| | | 34 | | /// <inheritdoc /> |
| | | 35 | | public override void Configure() |
| | | 36 | | { |
| | 0 | 37 | | Module.AddFastEndpointsAssembly(GetType()); |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <inheritdoc /> |
| | | 41 | | public override void Apply() |
| | | 42 | | { |
| | 0 | 43 | | Services |
| | 0 | 44 | | .AddMemoryStore<Label, InMemoryLabelStore>() |
| | 0 | 45 | | .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>() |
| | 0 | 46 | | .AddScoped(LabelStore) |
| | 0 | 47 | | .AddScoped(WorkflowDefinitionLabelStore) |
| | 0 | 48 | | ; |
| | | 49 | | |
| | 0 | 50 | | Services.AddNotificationHandlersFrom(GetType()); |
| | 0 | 51 | | } |
| | | 52 | | } |