using Elsa.Common.Features;
using Elsa.Expressions.Python.ActivityDescriptorModifiers;
using Elsa.Expressions.Features;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Expressions.Python.Activities;
using Elsa.Expressions.Python.Contracts;
using Elsa.Expressions.Python.HostedServices;
using Elsa.Expressions.Python.Options;
using Elsa.Expressions.Python.Providers;
using Elsa.Expressions.Python.Services;
using Elsa.Workflows;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Expressions.Python.Features;
///
/// Installs Python integration.
///
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(ExpressionsFeature))]
public class PythonFeature : FeatureBase
{
///
public PythonFeature(IModule module) : base(module)
{
}
///
/// Configures the .
///
public Action PythonOptions { get; set; } = _ => { };
///
public override void ConfigureHostedServices()
{
Module.ConfigureHostedService();
}
///
public override void Apply()
{
Services.Configure(PythonOptions);
// Python services.
Services
.AddScoped()
.AddExpressionDescriptorProvider()
.AddSingleton()
;
// Handlers.
Services.AddNotificationHandlersFrom();
// Activities.
Module.AddActivitiesFrom();
// UI property handlers.
Services.AddScoped();
}
}