Update MongoDb collection service retrieval (#5083)

The previous implementation used the generic MongoCollectionBase service to retrieve workflow definition and instance collections. Now, the code has been updated to use IMongoCollection specifically designed for WorkflowDefinition and WorkflowInstance. This change ensures better typing and possibly performance improvements.
This commit is contained in:
Dave Elbro 2024-03-18 22:15:24 +00:00 committed by GitHub
parent c1d0e7a0a2
commit a4a05dcbf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,7 @@ internal class CreateIndices : IHostedService
private static Task CreateWorkflowDefinitionIndices(IServiceScope serviceScope, CancellationToken cancellationToken)
{
var workflowDefinitionCollection = serviceScope.ServiceProvider.GetService<MongoCollectionBase<WorkflowDefinition>>();
var workflowDefinitionCollection = serviceScope.ServiceProvider.GetService<IMongoCollection<WorkflowDefinition>>();
if (workflowDefinitionCollection == null) return Task.CompletedTask;
return IndexHelpers.CreateAsync(
@ -51,7 +51,7 @@ internal class CreateIndices : IHostedService
private static Task CreateWorkflowInstanceIndices(IServiceScope serviceScope, CancellationToken cancellationToken)
{
var workflowInstanceCollection = serviceScope.ServiceProvider.GetService<MongoCollectionBase<WorkflowInstance>>();
var workflowInstanceCollection = serviceScope.ServiceProvider.GetService<IMongoCollection<WorkflowInstance>>();
if (workflowInstanceCollection == null) return Task.CompletedTask;
return IndexHelpers.CreateAsync(
@ -86,4 +86,5 @@ internal class CreateIndices : IHostedService
},
cancellationToken));
}
}
}