Open ling921 opened 10 months ago
From my perspective what you would like to achieve is not guaranteed within the resilient long running process. The host may execute the half of steps then get restarted and continue executing the rest of steps. So you can not rely on the WFC hoping that it would provide the same IMyService for all steps. You may inject IServiceScope and IServiceScopeFactory into your step. Maybe these interfaces being injected would help you with your needs? BTW, not sure Workflow-Core project is alive.
Is your feature request related to a problem? Please describe.
I have a scoped service
IMyService
and get anIMyService
instance from a scope, I hope that all steps will obtain the sameIMyService
instance when the workflow is running. This can prevent the services between multiple workflows from interfering with each other.Describe the solution you'd like
Add a method to
IWorkflowController
calledStartWorkflowWithScope
, which accept an additional parameterIServiceScope
, and then save it inWorkflowInstance
Describe alternatives you've considered
None
Additional context
I would like to make a pull request for this.