| | | 1 | | using CShells.Features; |
| | | 2 | | using Elsa.Alterations.Core.Contracts; |
| | | 3 | | using Elsa.Alterations.Core.Entities; |
| | | 4 | | using Elsa.Alterations.Core.Extensions; |
| | | 5 | | using Elsa.Alterations.Core.Stores; |
| | | 6 | | using Elsa.Alterations.Extensions; |
| | | 7 | | using Elsa.Alterations.Services; |
| | | 8 | | using Elsa.Extensions; |
| | | 9 | | using JetBrains.Annotations; |
| | | 10 | | using Microsoft.Extensions.DependencyInjection; |
| | | 11 | | |
| | | 12 | | namespace Elsa.Alterations.ShellFeatures; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Adds the Elsa alterations services. |
| | | 16 | | /// </summary> |
| | | 17 | | [ShellFeature( |
| | | 18 | | DisplayName = "Alterations", |
| | | 19 | | Description = "Provides workflow alteration capabilities for modifying running workflow instances")] |
| | | 20 | | [UsedImplicitly] |
| | | 21 | | public class AlterationsFeature : IShellFeature |
| | | 22 | | { |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets or sets the factory for the alteration plan store. |
| | | 25 | | /// </summary> |
| | 0 | 26 | | public Func<IServiceProvider, IAlterationPlanStore> AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredS |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets or sets the factory for the alteration job store. |
| | | 30 | | /// </summary> |
| | 0 | 31 | | public Func<IServiceProvider, IAlterationJobStore> AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredSer |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets or sets the factory for the alteration job dispatcher. |
| | | 35 | | /// </summary> |
| | 0 | 36 | | public Func<IServiceProvider, IAlterationJobDispatcher> AlterationJobDispatcherFactory { get; set; } = sp => sp.GetR |
| | | 37 | | |
| | | 38 | | public void ConfigureServices(IServiceCollection services) |
| | | 39 | | { |
| | 0 | 40 | | services.AddScoped<IAlterationPlanManager, AlterationPlanManager>(); |
| | 0 | 41 | | services.AddAlterations(); |
| | 0 | 42 | | services.AddAlterationsCore(); |
| | 0 | 43 | | services.AddScoped<BackgroundAlterationJobDispatcher>(); |
| | 0 | 44 | | services.AddScoped<IAlterationPlanScheduler, DefaultAlterationPlanScheduler>(); |
| | 0 | 45 | | services.AddScoped<IAlterationJobRunner, DefaultAlterationJobRunner>(); |
| | 0 | 46 | | services.AddScoped<IAlterationRunner, DefaultAlterationRunner>(); |
| | | 47 | | |
| | 0 | 48 | | services.AddMemoryStore<AlterationPlan, MemoryAlterationPlanStore>(); |
| | 0 | 49 | | services.AddMemoryStore<AlterationJob, MemoryAlterationJobStore>(); |
| | | 50 | | |
| | 0 | 51 | | services.AddScoped(AlterationPlanStoreFactory); |
| | 0 | 52 | | services.AddScoped(AlterationJobStoreFactory); |
| | 0 | 53 | | services.AddScoped(AlterationJobDispatcherFactory); |
| | 0 | 54 | | } |
| | | 55 | | } |
| | | 56 | | |