using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using Elsa.Sql.Activities;
using Elsa.Sql.Contracts;
using Elsa.Sql.Factory;
using Elsa.Sql.Implimentations;
using Elsa.Sql.Services;
using Elsa.Sql.UIHints;
using Elsa.Workflows;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Sql.Features;
///
/// Setup SQL client features
///
public class SqlFeature : FeatureBase
{
///
/// Set a callback to configure .
///
public Action Clients { get; set; } = _ => { };
///
///
///
///
public SqlFeature(IModule module) : base(module)
{
}
///
///
///
public override void Configure()
{
Module.AddActivitiesFrom();
}
///
///
///
public override void Apply()
{
Services
.AddSingleton(provider =>
{
ClientStore clientRegistry = new();
Clients.Invoke(clientRegistry);
return clientRegistry;
})
.AddSingleton()
// Providers
.AddScoped()
.AddScoped()
.AddScoped();
}
}