Fix API link (#13685)
parent
94c6629557
commit
b789a30c84
|
@ -5,7 +5,7 @@ description: Learn how ASP.NET Core implements dependency injection and how to u
|
|||
monikerRange: '>= aspnetcore-2.1'
|
||||
ms.author: riande
|
||||
ms.custom: mvc
|
||||
ms.date: 07/24/2019
|
||||
ms.date: 08/06/2019
|
||||
uid: fundamentals/dependency-injection
|
||||
---
|
||||
# Dependency injection in ASP.NET Core
|
||||
|
@ -169,7 +169,7 @@ Scoped lifetime services (<xref:Microsoft.Extensions.DependencyInjection.Service
|
|||
|
||||
### Singleton
|
||||
|
||||
Singleton lifetime services (<xref:Microsoft.AspNet.OData.Builder.ODataModelBuilder.AddSingleton*>) are created the first time they're requested (or when `Startup.ConfigureServices` is run and an instance is specified with the service registration). Every subsequent request uses the same instance. If the app requires singleton behavior, allowing the service container to manage the service's lifetime is recommended. Don't implement the singleton design pattern and provide user code to manage the object's lifetime in the class.
|
||||
Singleton lifetime services (<xref:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton*>) are created the first time they're requested (or when `Startup.ConfigureServices` is run and an instance is specified with the service registration). Every subsequent request uses the same instance. If the app requires singleton behavior, allowing the service container to manage the service's lifetime is recommended. Don't implement the singleton design pattern and provide user code to manage the object's lifetime in the class.
|
||||
|
||||
> [!WARNING]
|
||||
> It's dangerous to resolve a scoped service from a singleton. It may cause the service to have incorrect state when processing subsequent requests.
|
||||
|
|
Loading…
Reference in New Issue