From 6b8f935dc7b650cf9ebf2b27d0b1ab3acb6bb903 Mon Sep 17 00:00:00 2001 From: Choi-UngGyu Date: Mon, 16 Mar 2020 15:35:49 +0900 Subject: [PATCH] Make Configuration.AddServices public Modified access modifier to `public` so that library users can use` AddServices` method --- src/Configuration.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Configuration.cs b/src/Configuration.cs index 9837788..7ed3be6 100644 --- a/src/Configuration.cs +++ b/src/Configuration.cs @@ -7,11 +7,20 @@ namespace Unity.Microsoft.DependencyInjection { - internal static class Configuration + public static class Configuration { - internal static IUnityContainer AddServices(this IUnityContainer container, IServiceCollection services) + public static IUnityContainer AddServices(this IUnityContainer container, IServiceCollection services) { - var lifetime = ((UnityContainer)container).Configure().Lifetime; + var extension = ((UnityContainer)container).Configure(); + + if (extension == null) + { + extension = new MdiExtension(); + container.AddExtension(extension); + } + + var lifetime = extension.Lifetime; + var registerFunc = ((UnityContainer)container).Register; ((UnityContainer)container).Register = ((UnityContainer)container).AppendNew;