Synchronization code

This commit is contained in:
sunkaixuan
2023-08-20 03:54:09 +08:00
parent 2d97f8d715
commit 0552834f15
2 changed files with 14 additions and 9 deletions

View File

@@ -17,32 +17,37 @@ namespace SqlSugar
return GetEntityInfo(typeof(T));
}
public EntityInfo GetEntityInfoWithAttr(Type type)
{
return GetEntityInfo(type);
}
public EntityInfo GetEntityInfo(Type type)
{
var attr = type?.GetCustomAttribute<TenantAttribute>();
if (attr == null)
{
return GetEntityInfo(type);
return _GetEntityInfo(type);
}
else if (attr.configId.ObjToString() == this.Context?.CurrentConnectionConfig?.ConfigId+"")
else if (attr.configId.ObjToString() == this.Context?.CurrentConnectionConfig?.ConfigId + "")
{
return GetEntityInfo(type);
return _GetEntityInfo(type);
}
else if (this.Context.Root == null)
{
return GetEntityInfo(type);
return _GetEntityInfo(type);
}
else if (!this.Context.Root.IsAnyConnection(attr.configId))
{
return GetEntityInfo(type);
return _GetEntityInfo(type);
}
else
else
{
return this.Context.Root.GetConnection(attr.configId).EntityMaintenance.GetEntityInfo(type);
}
}
public EntityInfo GetEntityInfo(Type type)
private EntityInfo _GetEntityInfo(Type type)
{
string cacheKey = "GetEntityInfo" + type.GetHashCode() + type.FullName+this.Context?.CurrentConnectionConfig?.ConfigId;
string cacheKey = "GetEntityInfo" + type.GetHashCode() + type.FullName + this.Context?.CurrentConnectionConfig?.ConfigId;
return this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey,
() =>
{

View File

@@ -698,7 +698,7 @@ namespace SqlSugar
{
return result;
}
if (string.IsNullOrEmpty(OrderByValue)&&this.IsSqlQuery&&this.OldSql.HasValue() && (Skip == null && Take == null) && (this.WhereInfos == null || this.WhereInfos.Count == 0))
if (this.JoinQueryInfos.Count==0&&string.IsNullOrEmpty(OrderByValue)&&this.IsSqlQuery&&this.OldSql.HasValue() && (Skip == null && Take == null) && (this.WhereInfos == null || this.WhereInfos.Count == 0))
{
return this.OldSql;
}