From 831785fe9fc4e3fd00889ce59b38c68a6c021a9a Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Wed, 8 Jul 2015 15:29:01 -0700 Subject: [PATCH] Make AddAuthorization() idempotent Found this issue which looking into making AddMvc() idempotent. You'll end up with multiple pass-through handlers registered if two components call AddAuthorization(). This is very possible to happen if used two frameworks in the same app. --- .../ServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Authorization/ServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Authorization/ServiceCollectionExtensions.cs index 92f93fe1a3..d0a60edf2e 100644 --- a/src/Microsoft.AspNet.Authorization/ServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Authorization/ServiceCollectionExtensions.cs @@ -14,7 +14,7 @@ namespace Microsoft.Framework.DependencyInjection { services.AddOptions(); services.TryAdd(ServiceDescriptor.Transient()); - services.AddTransient(); + services.TryAddEnumerable(ServiceDescriptor.Transient()); return services; }