From b0d6a4bb0df59d790fe31d0b628b8a2ed97d873e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 26 Oct 2023 16:47:42 +0800 Subject: [PATCH] Update Instancefactory --- .../Infrastructure/InstanceFactory.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/InstanceFactory.cs index e995a0a6e..a9236cd6d 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/InstanceFactory.cs @@ -670,17 +670,32 @@ namespace SqlSugar } return type; } - internal static Type GetCustomTypeByClass(string className) { - var key = "Assembly_" + CustomDllName + assembly.GetHashCode(); + Type type = null; + foreach (var item in CustomDlls.AsEnumerable()) + { + if (type == null) + { + type = GetCustomTypeByClass(className, item); + } + if (type != null) + { + break; + } + } + return type; + } + internal static Type GetCustomTypeByClass(string className,string customDllName) + { + var key = "Assembly_" + customDllName + assembly.GetHashCode(); var newAssembly = new ReflectionInoCacheService().GetOrCreate(key, () => { try { var path = Assembly.GetExecutingAssembly().Location; if (path.HasValue()) { - path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), CustomDllName + ".dll"); + path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), customDllName + ".dll"); } if (path.HasValue() && FileHelper.IsExistFile(path)) {