Skip to content

Commit f84fa4f

Browse files
add warning about indirectly resolving scoped (#20302)
* add warning about indirectly resolving scoped * Update aspnetcore/fundamentals/dependency-injection.md Co-authored-by: Kirk Larkin <serpent5@pm.me> Co-authored-by: Kirk Larkin <serpent5@pm.me>
1 parent c61dc8b commit f84fa4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

aspnetcore/fundamentals/dependency-injection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ In apps that process requests, scoped services are disposed at the end of the re
166166

167167
When using Entity Framework Core, the <xref:Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.AddDbContext%2A> extension method registers `DbContext` types with a scoped lifetime by default.
168168

169-
Do ***not*** resolve a scoped service from a singleton. It may cause the service to have incorrect state when processing subsequent requests. It's fine to:
169+
Do ***not*** resolve a scoped service from a singleton and be careful not to do so indirectly, for example, through a transient service. It may cause the service to have incorrect state when processing subsequent requests. It's fine to:
170170

171171
* Resolve a singleton service from a scoped or transient service.
172172
* Resolve a scoped service from another scoped or transient service.

0 commit comments

Comments
 (0)