Update Automatic database switching with read-write separation

This commit is contained in:
sunkaixuan
2026-01-25 13:30:21 +08:00
parent d1ca2c9360
commit 0efdf3800f
2 changed files with 7 additions and 1 deletions

View File

@@ -403,7 +403,13 @@ namespace SqlSugar
ToSqlBefore();
sql = QueryBuilder.ToSqlString();
sql = QueryBuilder.ToCountSql(sql);
var oldIsDisableMasterSlaveSeparation = this.Context.Ado.IsDisableMasterSlaveSeparation;
if (this.QueryBuilder.IsDisableMasterSlaveSeparation)
{
this.Context.Ado.IsDisableMasterSlaveSeparation = true;
}
var result = Context.Ado.GetInt(sql, QueryBuilder.Parameters.ToArray());
this.Context.Ado.IsDisableMasterSlaveSeparation = oldIsDisableMasterSlaveSeparation;
return result;
}
protected async Task<int> GetCountAsync()

View File

@@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugarCore</id>
<version>5.1.4.211</version>
<version>5.1.4.213-preview04</version>
<authors>sunkaixuan</authors>
<owners>果糖大数据科技</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>