elsa-core/src/modules/Elsa.Agents.Persistence.EntityFrameworkCore/Feature.cs
Sipke Schoorstra 0c10113d7b Remove outdated database migration files
Deleted obsolete migration files from SQL Server, MySQL, and SQLite projects. This cleanup removes unused schema definitions and indexes, ensuring the repository remains up to date and free of unnecessary files.
2024-10-23 14:32:50 +02:00

38 lines
1.3 KiB
C#

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