mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-19 17:51:36 +08:00
Master Slave bug
This commit is contained in:
@@ -403,6 +403,8 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Context.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Context.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = DeleteBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
@@ -410,6 +412,7 @@ namespace SqlSugar
|
||||
diffModel.Time = this.Context.Ado.SqlExecutionTime;
|
||||
if (this.Context.Ado.DiffLogEvent != null)
|
||||
this.Context.Ado.DiffLogEvent(diffModel);
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
if (this.RemoveCacheFunc != null) {
|
||||
this.RemoveCacheFunc();
|
||||
@@ -420,12 +423,15 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Context.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Context.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = DeleteBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
diffModel.BeforeData = GetDiffTable(sql, parameters);
|
||||
diffModel.Sql = sql;
|
||||
diffModel.Parameters = parameters.ToArray();
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -456,6 +456,8 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = InsertBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
@@ -463,6 +465,7 @@ namespace SqlSugar
|
||||
diffModel.Time = this.Context.Ado.SqlExecutionTime;
|
||||
if (this.Context.Ado.DiffLogEvent != null)
|
||||
this.Context.Ado.DiffLogEvent(diffModel);
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
if (this.RemoveCacheFunc != null)
|
||||
{
|
||||
@@ -473,12 +476,15 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = InsertBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
diffModel.BeforeData = null;
|
||||
diffModel.Sql = sql;
|
||||
diffModel.Parameters = parameters.ToArray();
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
}
|
||||
private List<DiffLogTableInfo> GetDiffTable(string sql, long? identity)
|
||||
|
||||
@@ -411,7 +411,8 @@ namespace SqlSugar
|
||||
private void PreToSql()
|
||||
{
|
||||
UpdateBuilder.PrimaryKeys = GetPrimaryKeys();
|
||||
if (this.IsWhereColumns) {
|
||||
if (this.IsWhereColumns)
|
||||
{
|
||||
foreach (var pkName in UpdateBuilder.PrimaryKeys)
|
||||
{
|
||||
var isContains = this.UpdateBuilder.DbColumnInfoList.Select(it => it.DbColumnName.ToLower()).Contains(pkName.ToLower());
|
||||
@@ -609,6 +610,8 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = UpdateBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
@@ -616,8 +619,10 @@ namespace SqlSugar
|
||||
diffModel.Time = this.Context.Ado.SqlExecutionTime;
|
||||
if (this.Context.Ado.DiffLogEvent != null)
|
||||
this.Context.Ado.DiffLogEvent(diffModel);
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
if (this.RemoveCacheFunc != null) {
|
||||
if (this.RemoveCacheFunc != null)
|
||||
{
|
||||
this.RemoveCacheFunc();
|
||||
}
|
||||
}
|
||||
@@ -626,12 +631,15 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.IsEnableDiffLogEvent)
|
||||
{
|
||||
var isDisableMasterSlaveSeparation = this.Ado.IsDisableMasterSlaveSeparation;
|
||||
this.Ado.IsDisableMasterSlaveSeparation = true;
|
||||
var parameters = UpdateBuilder.Parameters;
|
||||
if (parameters == null)
|
||||
parameters = new List<SugarParameter>();
|
||||
diffModel.BeforeData = GetDiffTable(sql, parameters);
|
||||
diffModel.Sql = sql;
|
||||
diffModel.Parameters = parameters.ToArray();
|
||||
this.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user