Search code examples
elsa-workflows

Problem fetching workflow intance from DB


I'm using elsa-workflow v1.5 and trying to resume a workflow when user commit an action, by fetching the related workflow instance from db using this method

await _workflowInstanceStore.ListAllAsync()

But got an error about the data reader being open

Now I'm wondering if it is a valid approach? and if it is, how can I resolve this error?


Solution

  • To answer your question, the code you are using is valid. What you are experiencing is caused by the way Elsa 1.5 manages the DB context.

    Unless you are willing to fork Elsa 1.5 and reimplement the persistence EF Core provider or provide your own implementation of the persistence abstractions, I'm afraid there's no simple way to resolve this error other than upgrading to Elsa 2.0 where this is fixed.