You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a scoped service IMyService and get an IMyService instance from a scope, I hope that all steps will obtain the same IMyService 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 called StartWorkflowWithScope, which accept an additional parameter IServiceScope, and then save it in WorkflowInstance
Describe alternatives you've considered
None
Additional context
I would like to make a pull request for this.
The text was updated successfully, but these errors were encountered:
ling921
changed the title
[Proposal] Add custom IServiceScope support so that Step only accesses service instances of this scope
[Proposal] Add IServiceScope support so that steps can get same service instances from this scope
Jan 27, 2024
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.
The text was updated successfully, but these errors were encountered: