mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 增加 ISelect.AsCteTree() 递归查询树表所有子记录;
This commit is contained in:
@ -533,7 +533,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (transaction == null && connection == null)
|
||||
{
|
||||
//读写分离规则
|
||||
if (this.SlavePools.Any() && cmdText.StartsWith("SELECT ", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (this.SlavePools.Any() && IsFromSlave(cmdText))
|
||||
{
|
||||
var availables = slaveUnavailables == 0 ?
|
||||
//查从库
|
||||
|
@ -458,7 +458,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (transaction == null && connection == null)
|
||||
{
|
||||
//读写分离规则
|
||||
if (this.SlavePools.Any() && cmdText.StartsWith("SELECT ", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (this.SlavePools.Any() && IsFromSlave(cmdText))
|
||||
{
|
||||
var availables = slaveUnavailables == 0 ?
|
||||
//查从库
|
||||
|
@ -45,5 +45,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "(").Append(")").ToString();
|
||||
}
|
||||
|
||||
public static bool IsFromSlave(string cmdText)
|
||||
{
|
||||
return cmdText.StartsWith("SELECT ", StringComparison.CurrentCultureIgnoreCase) ||
|
||||
cmdText.StartsWith("WITH ", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
public int FieldCount { get; set; }
|
||||
public Func<IFreeSql, DbDataReader, T1> Read { get; set; }
|
||||
}
|
||||
protected GetAllFieldExpressionTreeInfo GetAllFieldExpressionTreeLevelAll()
|
||||
public GetAllFieldExpressionTreeInfo GetAllFieldExpressionTreeLevelAll()
|
||||
{
|
||||
return _dicGetAllFieldExpressionTree.GetOrAdd($"*{string.Join("+", _tables.Select(a => $"{_orm.Ado.DataType}-{a.Table.DbName}-{a.Alias}-{a.Type}"))}", s =>
|
||||
{
|
||||
@ -735,7 +735,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
};
|
||||
});
|
||||
}
|
||||
protected GetAllFieldExpressionTreeInfo GetAllFieldExpressionTreeLevel2()
|
||||
public GetAllFieldExpressionTreeInfo GetAllFieldExpressionTreeLevel2()
|
||||
{
|
||||
return _dicGetAllFieldExpressionTree.GetOrAdd(string.Join("+", _tables.Select(a => $"{_orm.Ado.DataType}-{a.Table.DbName}-{a.Alias}-{a.Type}")), s =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user