diff --git a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs index b93a4ec8f..e1ae248df 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs @@ -47,6 +47,13 @@ namespace SqlSugar ISqlSugarClient db; List 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(); updateable.UpdateBuilder.LambdaExpressions.ParameterIndex = 1000; @@ -64,6 +71,13 @@ namespace SqlSugar ISqlSugarClient db; List 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(); updateable.UpdateBuilder.LambdaExpressions.ParameterIndex = 1000; diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs index 3987cca06..b0f3ea8d6 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs @@ -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) { diff --git a/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs b/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs index c43256591..81106b8ad 100644 --- a/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs +++ b/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs @@ -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; } diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs index 5a6df699c..5d47d73f4 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs @@ -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