elsa-core/src/modules/Elsa.Common/Multitenancy/Contracts
RalfvandenBurg c0e37e38d0
Fix/startuptask activate default tenant when empty (#7305)
* fix: activate Tenant.Default when no tenants configured (Option C)

Ensures IStartupTask implementations (e.g., PopulateRegistriesStartupTask,
RunMigrationsStartupTask) run when multitenancy is enabled but the tenant
provider returns an empty list.

- In DefaultTenantService: treat empty provider response as [Tenant.Default]
  in GetTenantsDictionaryAsync (initial load) and RefreshAsync
- Logic is internal to tenant service; no explicit call required

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: add DefaultTenantService tests for empty-provider fallback

- ActivateTenantsAsync_WhenProviderReturnsEmpty_ActivatesDefaultTenant
- ListAsync_WhenProviderReturnsEmpty_ReturnsDefaultTenant
- ActivateTenantsAsync_WhenProviderReturnsTenants_ReturnsThoseTenants
- RefreshAsync_WhenProviderChangesFromTenantsToEmpty_KeepsDefaultTenant

Co-authored-by: Cursor <cursoragent@cursor.com>

* PR feedback disposes serviceprovider also

---------

Co-authored-by: Ralf <Ralf@Careconnections.nl>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-04-11 11:00:12 +02:00
..
IBackgroundTaskStarter.cs Enhance Multitenancy with Runtime Tenant Management and Task Handling (#6173) 2024-12-03 15:07:55 +01:00
ITaskExecutor.cs Enhance Multitenancy with Runtime Tenant Management and Task Handling (#6173) 2024-12-03 15:07:55 +01:00
ITenantAccessor.cs Implement null TenantId for tenant-agnostic entities (#7226) 2026-02-02 10:59:01 +01:00
ITenantActivatedEvent.cs Enhance Multitenancy with Runtime Tenant Management and Task Handling (#6173) 2024-12-03 15:07:55 +01:00
ITenantDeactivatedEvent.cs Enhance Multitenancy with Runtime Tenant Management and Task Handling (#6173) 2024-12-03 15:07:55 +01:00
ITenantDeletedEvent.cs Introduce TenantDeleted event to handle tenant cleanup (#6843) 2025-08-06 08:43:39 +02:00
ITenantFinder.cs Add multitenancy support for background tasks (#6059) 2024-10-28 19:38:24 +01:00
ITenantResolver.cs Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
ITenantScope.cs Improves tenant task management with dependencies (#7174) 2025-12-29 20:49:24 +01:00
ITenantScopeFactory.cs Refactor Tenant Resolution to Use Async Local Storage for Operation-wide Access (#6022) 2024-10-12 12:08:09 +02:00
ITenantService.cs Fix/startuptask activate default tenant when empty (#7305) 2026-04-11 11:00:12 +02:00
ITenantsProvider.cs Enhance Multitenancy with Runtime Tenant Management and Task Handling (#6173) 2024-12-03 15:07:55 +01:00