Synchronization code

This commit is contained in:
sunkaixuan 2023-09-28 18:01:34 +08:00
parent a21114d580
commit e183cc607b
4 changed files with 23 additions and 1 deletions

View File

@ -47,6 +47,13 @@ namespace SqlSugar
ISqlSugarClient db;
List<SugarParameter> pars;
string where;
var isAutoDelFilter =
DeleteBuilder.Context?.CurrentConnectionConfig?.MoreSettings?.IsAutoDeleteQueryFilter == true &&
DeleteBuilder.Context?.CurrentConnectionConfig?.MoreSettings?.IsAutoUpdateQueryFilter == true;
if (isAutoDelFilter)
{
DeleteBuilder.Context.CurrentConnectionConfig.MoreSettings.IsAutoUpdateQueryFilter = false;
}
LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars);
var updateable = db.Updateable<T>();
updateable.UpdateBuilder.LambdaExpressions.ParameterIndex = 1000;
@ -64,6 +71,13 @@ namespace SqlSugar
ISqlSugarClient db;
List<SugarParameter> pars;
string where;
var isAutoDelFilter =
DeleteBuilder.Context?.CurrentConnectionConfig?.MoreSettings?.IsAutoDeleteQueryFilter == true &&
DeleteBuilder.Context?.CurrentConnectionConfig?.MoreSettings?.IsAutoUpdateQueryFilter == true;
if (isAutoDelFilter)
{
DeleteBuilder.Context.CurrentConnectionConfig.MoreSettings.IsAutoUpdateQueryFilter = false;
}
LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars);
var updateable = db.Updateable<T>();
updateable.UpdateBuilder.LambdaExpressions.ParameterIndex = 1000;

View File

@ -223,6 +223,10 @@ namespace SqlSugar
if (IsTrakingData())
{
var trackingData = this.Context.TempItems.FirstOrDefault(it => it.Key.StartsWith("Tracking_" + item.GetHashCode()));
if (trackingData.Key == null && trackingData.Value == null)
{
return;
}
var diffColumns = FastCopy.GetDiff(item, (T)trackingData.Value);
if (diffColumns.Count > 0)
{

View File

@ -21,6 +21,8 @@ namespace SqlSugar
public DateTime? DbMinDate { get; set; } = Convert.ToDateTime("1900-01-01");
public bool IsNoReadXmlDescription { get; set; }
public bool SqlServerCodeFirstNvarchar { get; set; }
public bool SqliteCodeFirstEnableDefaultValue { get; set; }
public bool SqliteCodeFirstEnableDescription { get; set; }
public bool IsAutoUpdateQueryFilter { get; set; }
public bool IsAutoDeleteQueryFilter { get; set; }
public bool EnableModelFuncMappingColumn { get; set; }

View File

@ -485,7 +485,9 @@ namespace SqlSugar
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn,
EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity,
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery,
EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision
EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision,
SqliteCodeFirstEnableDefaultValue=it.MoreSettings.SqliteCodeFirstEnableDefaultValue,
SqliteCodeFirstEnableDescription=it.MoreSettings.SqliteCodeFirstEnableDescription
},
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle