diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs index adc8b96d1..771a3bae4 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs @@ -6,13 +6,14 @@ using System.Text; using System.Threading.Tasks; namespace SqlSugar { - + public class InstanceFactory { static Assembly assembly = Assembly.GetExecutingAssembly(); static Dictionary typeCache = new Dictionary(); private static string _CustomDllName = ""; private static List CustomDlls = new List(); + public static Assembly[] CustomAssemblies = new Assembly[]{}; public static string CustomDllName { get { return _CustomDllName; } set @@ -637,6 +638,10 @@ namespace SqlSugar var newAssembly = new ReflectionInoCacheService().GetOrCreate(key, () => { try { + if (CustomAssemblies?.Any(it => it.FullName.StartsWith(customDllName))==true) + { + return CustomAssemblies?.First(it => it.FullName.StartsWith(customDllName)); + } var path = Assembly.GetExecutingAssembly().Location; if (path.HasValue()) { @@ -692,6 +697,10 @@ namespace SqlSugar var newAssembly = new ReflectionInoCacheService().GetOrCreate(key, () => { try { + if (CustomAssemblies?.Any(it => it.FullName.StartsWith(customDllName)) == true) + { + return CustomAssemblies?.First(it => it.FullName.StartsWith(customDllName)); + } var path = Assembly.GetExecutingAssembly().Location; if (path.HasValue()) {