KEMBAR78
Support resolving application services from singleton internal services by ajcvickers · Pull Request #29950 · dotnet/efcore · GitHub
Skip to content

Conversation

@ajcvickers
Copy link
Contributor

Fixes #13540

Scoped and transient internal services can obtain application services using the DbContext as a service locator. Singleton services cannot do this since they do not have access to the DbContext. This change allows the root application service provider to be registered as an ISingletonOption such that singleton internal services can resolve singleton and transient application services.

@ajcvickers ajcvickers requested a review from a team December 30, 2022 19:30
Fixes #13540

Scoped and transient internal services can obtain application services using the `DbContext` as a service locator. Singleton services cannot do this since they do not have access to the `DbContext`. This change allows the root application service provider to be registered as an `ISingletonOption` such that singleton internal services can resolve singleton and transient application services.
@ajcvickers
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers ajcvickers merged commit ad8db34 into main Dec 31, 2022
@ajcvickers ajcvickers deleted the KnowYourRoots1230 branch December 31, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow services to be easily resolved from the application service provider from within EF Core

2 participants