-
Notifications
You must be signed in to change notification settings - Fork 313
Multiple nested scope registrations #327
Comments
Moving this to Backlog as we are not planning to make any changes for this at this time. |
I am looking at how to achieve the following. As well as an |
It would be really good if I could register some sort of generic delegate into the child container to be invoked as a fallback for whenever a service wasn't registered - in there I could defer resolution to an alternate IServiceProvider (i.e the parent one).. Is this possible? |
This issue was moved to dotnet/aspnetcore#2351 |
When doing multiple nested scopes through
IServiceScopeFactory.CreateScope()
, you get nestedIServiceProvider
instances. It doesn't, however, give access to registrations for each scope.Therefore if you have scopes which are created further down the pipeline (with some service data only accessible from that step in the pipeline, which isn't available at the root), you can't really register services to use in there.
The sought-after structure being:
Scope (root)
- Register (root)
- Resolve (root level)
<- Scope (level 1)
- Register (level 1)
- Resolve (root level + level 1)
<- Scope (level 2)
- Register (level 2)
- Resolve (root level + level 1 + level 2)
I don't know if there's an alternative way of achieving this, but so far the documentation is scarce.
The text was updated successfully, but these errors were encountered: