using Elsa.Agents.Persistence.Entities;
using Elsa.Agents.Persistence.Features;
using Elsa.EntityFrameworkCore;
using Elsa.EntityFrameworkCore.EntityHandlers;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Agents.Persistence.EntityFrameworkCore;
///
/// Configures the default workflow runtime to use EF Core persistence providers.
///
[DependsOn(typeof(AgentPersistenceFeature))]
public class EFCoreAgentPersistenceFeature(IModule module) : PersistenceFeatureBase(module)
{
///
public override void Configure()
{
Module.Configure(feature =>
{
feature
.UseApiKeyStore(sp => sp.GetRequiredService())
.UseServiceStore(sp => sp.GetRequiredService())
.UseAgentStore(sp => sp.GetRequiredService());
;
});
}
///
public override void Apply()
{
base.Apply();
AddEntityStore();
AddEntityStore();
AddEntityStore();
Services.AddScoped();
Services.AddScoped();
}
}