Update Instancefactory

This commit is contained in:
sunkaixuan 2023-10-26 16:47:42 +08:00
parent e5f8149c97
commit b0d6a4bb0d

View File

@ -670,17 +670,32 @@ namespace SqlSugar
}
return type;
}
internal static Type GetCustomTypeByClass<T>(string className)
{
var key = "Assembly_" + CustomDllName + assembly.GetHashCode();
Type type = null;
foreach (var item in CustomDlls.AsEnumerable())
{
if (type == null)
{
type = GetCustomTypeByClass<T>(className, item);
}
if (type != null)
{
break;
}
}
return type;
}
internal static Type GetCustomTypeByClass<T>(string className,string customDllName)
{
var key = "Assembly_" + customDllName + assembly.GetHashCode();
var newAssembly = new ReflectionInoCacheService().GetOrCreate<Assembly>(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))
{