| | | 1 | | using Elsa.Common.Multitenancy; |
| | | 2 | | using Elsa.Features.Attributes; |
| | | 3 | | using Elsa.Features.Services; |
| | | 4 | | using Elsa.Tenants.Features; |
| | | 5 | | using Microsoft.Extensions.DependencyInjection; |
| | | 6 | | |
| | | 7 | | namespace Elsa.Persistence.EFCore.Modules.Tenants; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Configures the <see cref="TenantManagementFeature"/> feature with an Entity Framework Core persistence provider. |
| | | 11 | | /// </summary> |
| | | 12 | | [DependsOn(typeof(TenantManagementFeature))] |
| | 0 | 13 | | public class EFCoreTenantManagementFeature(IModule module) : PersistenceFeatureBase<EFCoreTenantManagementFeature, Tenan |
| | | 14 | | { |
| | | 15 | | /// <inheritdoc /> |
| | | 16 | | public override void Configure() |
| | | 17 | | { |
| | 0 | 18 | | Module.Configure<TenantManagementFeature>(feature => |
| | 0 | 19 | | { |
| | 0 | 20 | | feature.WithTenantStore(sp => sp.GetRequiredService<EFCoreTenantStore>()); |
| | 0 | 21 | | }); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc /> |
| | | 25 | | public override void Apply() |
| | | 26 | | { |
| | 0 | 27 | | base.Apply(); |
| | 0 | 28 | | AddEntityStore<Tenant, EFCoreTenantStore>(); |
| | 0 | 29 | | } |
| | | 30 | | |
| | | 31 | | protected override void ConfigureMigrations() |
| | | 32 | | { |
| | 0 | 33 | | Module.ConfigureHostedService<RunMigrationsHostedService<TenantsElsaDbContext>>(-100); |
| | 0 | 34 | | } |
| | | 35 | | } |