Browse Source

Update custom database

pull/14/head
sunkaixuan 3 years ago
parent
commit
d9cebd441f
  1. 8
      Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs

8
Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs

@ -419,6 +419,10 @@ namespace SqlSugar
else else
{ {
type = GetCustomTypeByClass(className + "`" + types.Length).MakeGenericType(types); type = GetCustomTypeByClass(className + "`" + types.Length).MakeGenericType(types);
if (type == null)
{
type = Type.GetType(className + "`" + types.Length, true).MakeGenericType(types);
}
} }
Check.ArgumentNullException(type, string.Format(ErrorMessage.ObjNotExist, className)); Check.ArgumentNullException(type, string.Format(ErrorMessage.ObjNotExist, className));
if (!typeCache.ContainsKey(cacheKey)) if (!typeCache.ContainsKey(cacheKey))
@ -441,6 +445,10 @@ namespace SqlSugar
else else
{ {
type = GetCustomTypeByClass(className + "`" + types.Length).MakeGenericType(types); type = GetCustomTypeByClass(className + "`" + types.Length).MakeGenericType(types);
if (type == null)
{
type = Type.GetType(className + "`" + types.Length, true).MakeGenericType(types);
}
} }
var result = (Restult)Activator.CreateInstance(type, true); var result = (Restult)Activator.CreateInstance(type, true);
return result; return result;

Loading…
Cancel
Save