Optimize Job

This commit is contained in:
sunkaixuan
2023-01-10 13:25:35 +08:00
parent f3660397a3
commit f72d775ee8
2 changed files with 17 additions and 9 deletions

View File

@@ -26,12 +26,16 @@ namespace SqlSugar
if (methods.Length>=0)
{
foreach (var method in methods.Take(10))
{
var getInterfaces = method.GetMethod()?.ReflectedType?.ReflectedType?.GetInterfaces();
if (getInterfaces!=null&& getInterfaces.Any(it=>it.Name.IsIn("IJob", "IHostedService")))
{
var refType = method.GetMethod()?.ReflectedType;
if (refType != null)
{
key = $"{key}IJob";
break;
var getInterfaces = refType.Name.StartsWith("<") ? refType?.ReflectedType?.GetInterfaces() : refType?.GetInterfaces();
if (getInterfaces != null && getInterfaces.Any(it => it.Name.IsIn("IJob")))
{
key = $"{key}IJob";
break;
}
}
}
}

View File

@@ -98,11 +98,15 @@ namespace SqlSugar
{
foreach (var method in frames.Take(10))
{
var getInterfaces = method.GetMethod()?.ReflectedType?.ReflectedType?.GetInterfaces();
if (getInterfaces != null && getInterfaces.Any(it => it.Name.IsIn("IJob", "IHostedService")))
var refType = method.GetMethod()?.ReflectedType;
if (refType != null)
{
key = $"{key}IJob";
break;
var getInterfaces = refType.Name.StartsWith("<") ? refType?.ReflectedType?.GetInterfaces() : refType?.GetInterfaces();
if (getInterfaces != null && getInterfaces.Any(it => it.Name.IsIn("IJob")))
{
key = $"{key}IJob";
break;
}
}
}
}