Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/Elsa.Persistence.EFCore.Common/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public async Task SaveManyAsync(
}

// When doing a custom SQL query (Bulk Upsert), none of the installed query filters will be applied. Hence, we are assigning the current tenant ID explicitly.
var tenantId = serviceProvider.GetRequiredService<ITenantAccessor>().Tenant?.Id;
var tenantId = serviceProvider.GetRequiredService<ITenantAccessor>().TenantId;
foreach (var entity in entityList)
{
if (entity is Entity entityWithTenant)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public async Task<TDbContext> CreateDbContextAsync(CancellationToken cancellatio
private void SetTenantId(TDbContext context)
{
if (context is ElsaDbContextBase elsaContext)
elsaContext.TenantId = tenantAccessor.Tenant?.Id;
elsaContext.TenantId = tenantAccessor.TenantId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<IEnumerable<WorkflowDefinition>> PopulateStoreAsync(bool index
foreach (var result in results)
{
// Normalize tenant IDs for comparison (null becomes empty string)
var definitionTenantId = result.Workflow.Identity.TenantId.NormalizeTenantId();
var definitionTenantId = result.Workflow.Identity.TenantId ?? Tenant.AgnosticTenantId;
Comment thread
RalfvandenBurg marked this conversation as resolved.
Outdated

// Only import workflows belonging to the current tenant or tenant-agnostic workflows (TenantId = "*").
if (definitionTenantId != currentTenantId && definitionTenantId != Tenant.AgnosticTenantId)
Expand Down Expand Up @@ -191,8 +191,8 @@ private async Task<WorkflowDefinition> AddOrUpdateCoreAsync(MaterializedWorkflow
await UpdateIsPublished();

// Determine the tenant ID for the workflow definition
// If the workflow has no tenant ID, use the current tenant (normalized to handle null -> "")
var workflowTenantId = workflow.Identity.TenantId ?? (_tenantAccessor.Tenant?.Id).NormalizeTenantId();
// If the workflow has no tenant ID, use the current tenant (normalized to handle null -> "*")
var workflowTenantId = workflow.Identity.TenantId ?? _tenantAccessor.Tenant?.Id ?? Tenant.AgnosticTenantId;
Comment thread
RalfvandenBurg marked this conversation as resolved.
Outdated

var workflowDefinition = existingDefinitionVersion ?? new WorkflowDefinition
{
Expand Down