elsa-core/src/modules/Elsa.Persistence.EFCore.SqlServer/DbContextFactories.cs
Sipke Schoorstra ff1f0833ad
Restore EF Core persistence layer (#6931)
* Restore EF Core persistence layer

Originally, we had moved EF Core to the extensions repo, but in practice this turned out to be rather impractical when debugging elsa-core, given that we would lose all of the state (workflow definitions, instances, etc.) across application restarts.

* Integrate PostgreSQL support into EF Core persistence and enhance BlobStorage workflows provider setup.
2025-09-27 20:39:18 +02:00

40 lines
1.6 KiB
C#

using Elsa.Persistence.EFCore.Abstractions;
using Elsa.Persistence.EFCore.Extensions;
using Elsa.Persistence.EFCore.Modules.Alterations;
using Elsa.Persistence.EFCore.Modules.Identity;
using Elsa.Persistence.EFCore.Modules.Labels;
using Elsa.Persistence.EFCore.Modules.Management;
using Elsa.Persistence.EFCore.Modules.Runtime;
using Elsa.Persistence.EFCore.Modules.Tenants;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
namespace Elsa.Persistence.EFCore.SqlServer;
[UsedImplicitly]
public class IdentityDbContextFactory : SqlServerDesignTimeDbContextFactory<IdentityElsaDbContext>;
[UsedImplicitly]
public class ManagementDbContextFactory : SqlServerDesignTimeDbContextFactory<ManagementElsaDbContext>;
[UsedImplicitly]
public class RuntimeDbContextFactory : SqlServerDesignTimeDbContextFactory<RuntimeElsaDbContext>;
[UsedImplicitly]
public class LabelsDbContextFactory : SqlServerDesignTimeDbContextFactory<LabelsElsaDbContext>;
[UsedImplicitly]
public class AlterationsDbContextFactories : SqlServerDesignTimeDbContextFactory<AlterationsElsaDbContext>;
[UsedImplicitly]
public class TenantsDbContextFactories : SqlServerDesignTimeDbContextFactory<TenantsElsaDbContext>;
public class SqlServerDesignTimeDbContextFactory<TDbContext> : DesignTimeDbContextFactoryBase<TDbContext> where TDbContext : DbContext
{
protected override void ConfigureBuilder(DbContextOptionsBuilder<TDbContext> builder, string connectionString)
{
builder.UseElsaSqlServer(GetType().Assembly, connectionString);
}
}