mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update db.DeleteNav
This commit is contained in:
parent
8ee44ff527
commit
6be209c59b
@ -31,7 +31,9 @@ namespace SqlSugar
|
||||
if (IsDeleteA())
|
||||
{
|
||||
if (!_IsDeletedParant)
|
||||
SetContext(() => this._Context.Deleteable(parentList).ExecuteCommand());
|
||||
SetContext(() => this._Context.Deleteable(parentList)
|
||||
.EnableDiffLogEventIF(_RootOptions?.IsDiffLogEvent == true, _RootOptions?.DiffLogBizData)
|
||||
.ExecuteCommand());
|
||||
}
|
||||
|
||||
var aids = _ParentList.Select(it => parentPkColumn.PropertyInfo.GetValue(it)).ToList();
|
||||
|
@ -25,7 +25,9 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
if (!_IsDeletedParant)
|
||||
SetContext(() => this._Context.Deleteable(prentList).ExecuteCommand());
|
||||
SetContext(() => this._Context.Deleteable(prentList)
|
||||
.EnableDiffLogEventIF(_RootOptions?.IsDiffLogEvent==true,_RootOptions?.DiffLogBizData)
|
||||
.ExecuteCommand());
|
||||
|
||||
var ids = _ParentList.Select(it => parentPkColumn.PropertyInfo.GetValue(it)).ToList();
|
||||
var childList = GetChildList<TChild>().In(thisFkColumn.DbColumnName, ids).ToList();
|
||||
|
@ -20,7 +20,9 @@ namespace SqlSugar
|
||||
|
||||
|
||||
if (!_IsDeletedParant)
|
||||
SetContext(() => this._Context.Deleteable(parentList).ExecuteCommand());
|
||||
SetContext(() => this._Context.Deleteable(parentList)
|
||||
.EnableDiffLogEventIF(_RootOptions?.IsDiffLogEvent == true, _RootOptions?.DiffLogBizData)
|
||||
.ExecuteCommand());
|
||||
|
||||
|
||||
var ids = _ParentList.Select(it => parentColumn.PropertyInfo.GetValue(it)).ToList();
|
||||
|
@ -16,6 +16,7 @@ namespace SqlSugar
|
||||
public EntityInfo _ParentEntity { get; set; }
|
||||
public EntityColumnInfo _ParentPkColumn { get; set; }
|
||||
public SqlSugarProvider _Context { get; set; }
|
||||
internal DeleteNavRootOptions _RootOptions { get; set; }
|
||||
public bool _IsDeletedParant { get; set; }
|
||||
public List<string> _WhereList = new List<string>();
|
||||
public List<SugarParameter> _Parameters = new List<SugarParameter>();
|
||||
|
@ -1153,6 +1153,25 @@ namespace SqlSugar
|
||||
{
|
||||
return DeleteNav(this.Queryable<T>().Where(whereExpression).ToList());
|
||||
}
|
||||
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return DeleteNav(new List<T>() { data }, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
var result = new DeleteNavTaskInit<T, T>();
|
||||
result.deleteNavProvider = new DeleteNavProvider<T, T>();
|
||||
result.deleteNavProvider._Roots = datas;
|
||||
result.deleteNavProvider._Context = this;
|
||||
result.deleteNavProvider._RootOptions = options;
|
||||
return result;
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T, bool>> whereExpression, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return DeleteNav(this.Queryable<T>().Where(whereExpression).ToList(),options);
|
||||
}
|
||||
|
||||
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||
{
|
||||
return UpdateNav(new List<T>() { data });
|
||||
|
@ -769,6 +769,18 @@ namespace SqlSugar
|
||||
{
|
||||
return ScopedContext.DeleteNav(whereExpression);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(data, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(datas, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T, bool>> whereExpression, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(whereExpression, options);
|
||||
}
|
||||
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||
{
|
||||
return ScopedContext.UpdateNav(data);
|
||||
|
@ -12,6 +12,11 @@ namespace SqlSugar
|
||||
public bool ManyToManyIsDeleteA { get; set; }
|
||||
public bool ManyToManyIsDeleteB { get; set; }
|
||||
}
|
||||
public class DeleteNavRootOptions
|
||||
{
|
||||
public bool IsDiffLogEvent { get; set; }
|
||||
public object DiffLogBizData { get; set; }
|
||||
}
|
||||
public class InsertNavRootOptions
|
||||
{
|
||||
public string[] IgnoreColumns { get; set; }
|
||||
|
@ -228,6 +228,9 @@ namespace SqlSugar
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(T data) where T : class, new();
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas) where T : class, new();
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T,bool>> whereExpression) where T : class, new();
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(T data, DeleteNavRootOptions options) where T : class, new();
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas, DeleteNavRootOptions options) where T : class, new();
|
||||
DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T, bool>> whereExpression, DeleteNavRootOptions options) where T : class, new();
|
||||
UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new ();
|
||||
UpdateNavTaskInit<T, T> UpdateNav<T>(List<T> datas) where T : class, new ();
|
||||
UpdateNavTaskInit<T, T> UpdateNav<T>(T data,UpdateNavRootOptions rootOptions) where T : class, new();
|
||||
|
@ -230,6 +230,20 @@ namespace SqlSugar
|
||||
{
|
||||
return this.Context.DeleteNav(whereExpression);
|
||||
}
|
||||
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return this.Context.DeleteNav(data, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return this.Context.DeleteNav(datas, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T, bool>> whereExpression, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return this.Context.DeleteNav(whereExpression, options);
|
||||
}
|
||||
|
||||
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||
{
|
||||
return this.Context.UpdateNav(data);
|
||||
|
@ -815,6 +815,21 @@ namespace SqlSugar
|
||||
{
|
||||
return ScopedContext.DeleteNav(whereExpression);
|
||||
}
|
||||
|
||||
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(data, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(datas, options);
|
||||
}
|
||||
public DeleteNavTaskInit<T, T> DeleteNav<T>(Expression<Func<T, bool>> whereExpression, DeleteNavRootOptions options) where T : class, new()
|
||||
{
|
||||
return ScopedContext.DeleteNav(whereExpression, options);
|
||||
}
|
||||
|
||||
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||
{
|
||||
return ScopedContext.UpdateNav(data);
|
||||
|
Loading…
Reference in New Issue
Block a user