using CShells.Features;
using Elsa.Alterations.Core.Contracts;
using Elsa.Alterations.Core.Entities;
using Elsa.Alterations.Core.Extensions;
using Elsa.Alterations.Core.Stores;
using Elsa.Alterations.Extensions;
using Elsa.Alterations.Services;
using Elsa.Extensions;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Alterations.ShellFeatures;
///
/// Adds the Elsa alterations services.
///
[ShellFeature(
DisplayName = "Alterations",
Description = "Provides workflow alteration capabilities for modifying running workflow instances")]
[UsedImplicitly]
public class AlterationsFeature : IShellFeature
{
///
/// Gets or sets the factory for the alteration plan store.
///
public Func AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredService();
///
/// Gets or sets the factory for the alteration job store.
///
public Func AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredService();
///
/// Gets or sets the factory for the alteration job dispatcher.
///
public Func AlterationJobDispatcherFactory { get; set; } = sp => sp.GetRequiredService();
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped();
services.AddAlterations();
services.AddAlterationsCore();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddMemoryStore();
services.AddMemoryStore();
services.AddScoped(AlterationPlanStoreFactory);
services.AddScoped(AlterationJobStoreFactory);
services.AddScoped(AlterationJobDispatcherFactory);
}
}