From ef0d01340ecf0e4fa4fb885af945a26394275dc5 Mon Sep 17 00:00:00 2001 From: Eugene Sadocoi Date: Wed, 11 Dec 2019 22:47:43 -0800 Subject: [PATCH] Fixed #70 --- package.props | 2 +- src/Extensions/HostingExtension.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.props b/package.props index 2f31c1d..7aaa6f1 100644 --- a/package.props +++ b/package.props @@ -1,7 +1,7 @@ - 5.11.4 + 5.11.5 This release is compatible with Core 3.1 diff --git a/src/Extensions/HostingExtension.cs b/src/Extensions/HostingExtension.cs index 2e278bb..a1178f3 100644 --- a/src/Extensions/HostingExtension.cs +++ b/src/Extensions/HostingExtension.cs @@ -14,11 +14,12 @@ public static IHostBuilder UseUnityServiceProvider(this IHostBuilder hostBuilder { _factory = new ServiceProviderFactory(container); - return hostBuilder.ConfigureServices((context, services) => - { - services.Replace(ServiceDescriptor.Singleton>(_factory)); - services.Replace(ServiceDescriptor.Singleton>(_factory)); - }); + return hostBuilder.UseServiceProviderFactory(_factory) + .ConfigureServices((context, services) => + { + services.Replace(ServiceDescriptor.Singleton>(_factory)); + services.Replace(ServiceDescriptor.Singleton>(_factory)); + }); } public static IWebHostBuilder UseUnityServiceProvider(this IWebHostBuilder hostBuilder, IUnityContainer container = null)