From dc3e99bed0926f4af9f1caad0e44267ab3305b22 Mon Sep 17 00:00:00 2001 From: yilianhuaixiao <85142297@qq.com> Date: Tue, 29 Oct 2019 10:28:05 +0800 Subject: [PATCH 1/3] optimization --- .../ServiceCollectionCommonExtensions.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs index 1b2d2c46524..772b5734afa 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs @@ -42,13 +42,9 @@ public static IServiceProvider BuildServiceProviderFromFactory([NotNull] this IS foreach (var service in services) { - var factoryInterface = service.ImplementationInstance?.GetType() - .GetTypeInfo() - .GetInterfaces() - .FirstOrDefault(i => i.GetTypeInfo().IsGenericType && - i.GetGenericTypeDefinition() == typeof(IServiceProviderFactory<>)); - - if (factoryInterface == null) + var factoryInterface = service.ServiceType; + if (service.ServiceType==null || !service.ServiceType.IsGenericType || + service.ServiceType.GetTypeInfo().GetGenericTypeDefinition() != typeof(IServiceProviderFactory<>)) { continue; } From f4ca2046923f116f5db7beecd708f67dc203e980 Mon Sep 17 00:00:00 2001 From: yilianhuaixiao <85142297@qq.com> Date: Tue, 29 Oct 2019 10:33:07 +0800 Subject: [PATCH 2/3] optimization --- .../DependencyInjection/ServiceCollectionCommonExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs index 772b5734afa..01df2f17e9c 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs @@ -43,8 +43,8 @@ public static IServiceProvider BuildServiceProviderFromFactory([NotNull] this IS foreach (var service in services) { var factoryInterface = service.ServiceType; - if (service.ServiceType==null || !service.ServiceType.IsGenericType || - service.ServiceType.GetTypeInfo().GetGenericTypeDefinition() != typeof(IServiceProviderFactory<>)) + if (factoryInterface==null || !factoryInterface.IsGenericType || + factoryInterface.GetTypeInfo().GetGenericTypeDefinition() != typeof(IServiceProviderFactory<>)) { continue; } From 690940ff4086a444edbff111f9ecf793310a0407 Mon Sep 17 00:00:00 2001 From: yilianhuaixiao <85142297@qq.com> Date: Tue, 29 Oct 2019 11:18:00 +0800 Subject: [PATCH 3/3] optimization --- .../DependencyInjection/ServiceCollectionCommonExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs index 01df2f17e9c..cc2195c6b54 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionCommonExtensions.cs @@ -43,7 +43,7 @@ public static IServiceProvider BuildServiceProviderFromFactory([NotNull] this IS foreach (var service in services) { var factoryInterface = service.ServiceType; - if (factoryInterface==null || !factoryInterface.IsGenericType || + if (factoryInterface == null || !factoryInterface.IsGenericType || factoryInterface.GetTypeInfo().GetGenericTypeDefinition() != typeof(IServiceProviderFactory<>)) { continue;