From dfb27d81318ba3219994e1528841bbd131e2c9b4 Mon Sep 17 00:00:00 2001
From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
Date: Tue, 27 Oct 2020 08:17:16 -1000
Subject: [PATCH] Auth handlers - any lifetime (#20309)
---
.../security/authorization/dependencyinjection.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/aspnetcore/security/authorization/dependencyinjection.md b/aspnetcore/security/authorization/dependencyinjection.md
index f310dd188f..bbe57cede8 100644
--- a/aspnetcore/security/authorization/dependencyinjection.md
+++ b/aspnetcore/security/authorization/dependencyinjection.md
@@ -11,11 +11,11 @@ uid: security/authorization/dependencyinjection
-[Authorization handlers must be registered](xref:security/authorization/policies#handler-registration) in the service collection during configuration (using [dependency injection](xref:fundamentals/dependency-injection)).
+[Authorization handlers must be registered](xref:security/authorization/policies#handler-registration) in the service collection during configuration using [dependency injection](xref:fundamentals/dependency-injection).
-Suppose you had a repository of rules you wanted to evaluate inside an authorization handler and that repository was registered in the service collection. Authorization will resolve and inject that into your constructor.
+Suppose you had a repository of rules you wanted to evaluate inside an authorization handler and that repository was registered in the service collection. Authorization resolves and injects that into the constructor.
-For example, if you wanted to use ASP.NET's logging infrastructure you would want to inject `ILoggerFactory` into your handler. Such a handler might look like:
+For example, to use ASP.NET's logging infrastructure, inject `ILoggerFactory` into the handler. Such a handler might look like the following code:
```csharp
public class LoggingAuthorizationHandler : AuthorizationHandler
@@ -36,13 +36,13 @@ public class LoggingAuthorizationHandler : AuthorizationHandler
}
```
-You would register the handler with `services.AddSingleton()`:
+The preceding handler can be registered with any [service lifetime](/dotnet/core/extensions/dependency-injection#service-lifetimes). The following code uses `AddSingleton` to register the preceding handler:
```csharp
services.AddSingleton();
```
-An instance of the handler will be created when your application starts, and DI will inject the registered `ILoggerFactory` into your constructor.
+An instance of the handler is created when the app starts, and DI injects the registered `ILoggerFactory` into the constructor.
> [!NOTE]
> Handlers that use Entity Framework shouldn't be registered as singletons.