using Elsa.Caching.Features;
using Elsa.Common.Features;
using Elsa.Expressions.CSharp.ActivityDescriptorModifiers;
using Elsa.Expressions.CSharp.Activities;
using Elsa.Expressions.CSharp.Contracts;
using Elsa.Expressions.CSharp.Options;
using Elsa.Expressions.CSharp.Providers;
using Elsa.Expressions.CSharp.Services;
using Elsa.Expressions.Features;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Workflows;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Expressions.CSharp.Features;
///
/// Installs C# integration.
///
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(ExpressionsFeature))]
[DependsOn(typeof(MemoryCacheFeature))]
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()
.AddSingleton()
;
// Handlers.
Services.AddNotificationHandlersFrom();
// Activities.
Module.AddActivitiesFrom();
// UI property handlers.
Services.AddScoped();
}
}