From f1a6eefe458d045454f479de106e14c6d95a3497 Mon Sep 17 00:00:00 2001 From: real-zony Date: Wed, 8 Feb 2023 20:56:04 +0800 Subject: [PATCH] fix: Fixed the issue where classes that don't implement an interface couldn't be injected. --- .../DependencyInject/AutoDependencyInjectExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ZonyLrcTools.Common/Infrastructure/DependencyInject/AutoDependencyInjectExtensions.cs b/src/ZonyLrcTools.Common/Infrastructure/DependencyInject/AutoDependencyInjectExtensions.cs index 78f6022..0b139d7 100644 --- a/src/ZonyLrcTools.Common/Infrastructure/DependencyInject/AutoDependencyInjectExtensions.cs +++ b/src/ZonyLrcTools.Common/Infrastructure/DependencyInject/AutoDependencyInjectExtensions.cs @@ -45,7 +45,7 @@ namespace ZonyLrcTools.Common.Infrastructure.DependencyInject public static List GetDefaultExposedTypes(Type type) { - var serviceTypes = new List(); + var serviceTypes = new List { type }; foreach (var interfaceType in type.GetTypeInfo().GetInterfaces()) { @@ -59,7 +59,6 @@ namespace ZonyLrcTools.Common.Infrastructure.DependencyInject if (type.Name.EndsWith(interfaceName)) { serviceTypes.Add(interfaceType); - serviceTypes.Add(type); } }