using Elsa.Common.Features;
using Elsa.CSharp.Contracts;
using Elsa.CSharp.Options;
using Elsa.CSharp.Providers;
using Elsa.CSharp.Services;
using Elsa.Expressions.Features;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.CSharp.Features;
///
/// Installs C# integration.
///
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(ExpressionsFeature))]
public class CSharpFeature : FeatureBase
{
///
public CSharpFeature(IModule module) : base(module)
{
}
///
/// Configures the .
///
public Action CSharpOptions { get; set; } = _ => { };
///
public override void Apply()
{
Services.Configure(CSharpOptions);
// C# services.
Services
.AddExpressionDescriptorProvider()
.AddScoped()
;
// Handlers.
Services.AddNotificationHandlersFrom();
// Activities.
Module.AddActivitiesFrom();
}
}