Get multiple workflow instances by id (IPersistenceProvider)
See original GitHub issueIn the new release of the workflow-core engine you have added the elastic search engine for filtering against different workflow properties. As a result the GetWorkflowInstances(…) service method on the IPersistenceProvider has been obselated while the GetWorkflowInstance(…) still remains active. In my optionion it makes sense to move all the filtering logic over to elastic serach but I’m missing a method to get multiple workflow instances by id:
Task<IEnumerable<WorkflowInstance>> GetWorkflowInstances(string[] ids)
For example, if we have a set of cached or filtered workflow results or IDs, we have to iterate over GetWorkflowInstance(…) one by one to get the WorkflowInstance DTO. Iterating over all ids is not performant.
Is it possible to provide a service method to retrieve multiple instances by a set of IDs?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
After discussing with @marc-mueller about this feature, I created a PR for it.
Because the persistence providers SQL Server, PostgreSQL and SQLite build on the EntityFramework percistence provider, only four persistence providers had to be adapted at all.
Unfortunately we have not the possibility to test and verify the functionality of the changed persistence providers DynamoDB (AWS) and Redis.
Hi @danielgerlag
I second Jan’s request. There are many scenario where we need to access multiple workflow instances as a batch. Often the business logic part contains a reference to a workflow instance and therefore there should be a way to retrieve multiple instances. Looping through a list and get an workflow instance at a time is not efficient.
Duplicating the data based on the lifetime events is in this case not a solution. Why would anyone duplicate the data and create a need to maintain every change in the workflow library in the duplicated data store just for being able to retrieve more than one instance at a time?
Is there a technical reason behind your suggestion for not allowing to query multiple instances by id from the persistence provider? To make that point clear, there is no requirement for any query logic or to be able to perform a search against the persistence provider. There is just a need to get multiple instance by ids at once.
Thanks! Marc