From 7b9fefe45f24ac7d578b6cc36b2914349a01a166 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 9 Mar 2022 23:17:15 +0800 Subject: [PATCH] Update custom database bug --- .../SqlSugar/Infrastructure/InstanceFactory.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/InstanceFactory.cs index 10490399b..8838e9430 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/InstanceFactory.cs @@ -527,7 +527,19 @@ namespace SqlSugar var newAssembly = new ReflectionInoCacheService().GetOrCreate(key, () => { try { - return Assembly.LoadFrom(CustomDllName + ".dll"); + var path = Assembly.GetExecutingAssembly().Location; + if (path.HasValue()) + { + path =System.IO.Path.Combine( System.IO.Path.GetDirectoryName(path), CustomDllName + ".dll"); + } + if (path.HasValue() && FileHelper.IsExistFile(path)) + { + return Assembly.LoadFrom(path); + } + else + { + return Assembly.LoadFrom(CustomDllName + ".dll"); + } } catch {