Skip to content
This repository was archived by the owner on Nov 2, 2018. It is now read-only.

Multiple nested scope registrations #327

Closed
ghost opened this issue Nov 13, 2015 · 4 comments
Closed

Multiple nested scope registrations #327

ghost opened this issue Nov 13, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 13, 2015

When doing multiple nested scopes through IServiceScopeFactory.CreateScope(), you get nested IServiceProvider 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.

@Eilon Eilon added this to the Backlog milestone Jan 23, 2016
@Eilon
Copy link
Member

Eilon commented Jan 23, 2016

Moving this to Backlog as we are not planning to make any changes for this at this time.

@dazinator
Copy link

dazinator commented Jul 13, 2017

I am looking at how to achieve the following.

As well as an IServiceProvider at the Application and at the RequestServices (scoped) level, I'd like have an IServiceProvider for each separate tenant of my application. The thing I can't figure out is, if I build an IServiceProvider for each tenant, how do I chain this IServiceProvider to a parent IServiceProvider such as request services - so that resolution fallsback from the tenant container to RequestServices?

@dazinator
Copy link

dazinator commented Jul 13, 2017

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?

@aspnet-hello
Copy link

This issue was moved to dotnet/aspnetcore#2351

@aspnet aspnet locked and limited conversation to collaborators Jan 1, 2018
@aspnet-hello aspnet-hello removed this from the Backlog milestone Jan 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants