mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Synchronization code
This commit is contained in:
parent
6be209c59b
commit
8fd3241d6a
@ -31,7 +31,9 @@ namespace SqlSugar
|
|||||||
if (IsDeleteA())
|
if (IsDeleteA())
|
||||||
{
|
{
|
||||||
if (!_IsDeletedParant)
|
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();
|
var aids = _ParentList.Select(it => parentPkColumn.PropertyInfo.GetValue(it)).ToList();
|
||||||
|
@ -25,7 +25,9 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_IsDeletedParant)
|
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 ids = _ParentList.Select(it => parentPkColumn.PropertyInfo.GetValue(it)).ToList();
|
||||||
var childList = GetChildList<TChild>().In(thisFkColumn.DbColumnName, ids).ToList();
|
var childList = GetChildList<TChild>().In(thisFkColumn.DbColumnName, ids).ToList();
|
||||||
|
@ -20,7 +20,9 @@ namespace SqlSugar
|
|||||||
|
|
||||||
|
|
||||||
if (!_IsDeletedParant)
|
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();
|
var ids = _ParentList.Select(it => parentColumn.PropertyInfo.GetValue(it)).ToList();
|
||||||
|
@ -16,6 +16,7 @@ namespace SqlSugar
|
|||||||
public EntityInfo _ParentEntity { get; set; }
|
public EntityInfo _ParentEntity { get; set; }
|
||||||
public EntityColumnInfo _ParentPkColumn { get; set; }
|
public EntityColumnInfo _ParentPkColumn { get; set; }
|
||||||
public SqlSugarProvider _Context { get; set; }
|
public SqlSugarProvider _Context { get; set; }
|
||||||
|
internal DeleteNavRootOptions _RootOptions { get; set; }
|
||||||
public bool _IsDeletedParant { get; set; }
|
public bool _IsDeletedParant { get; set; }
|
||||||
public List<string> _WhereList = new List<string>();
|
public List<string> _WhereList = new List<string>();
|
||||||
public List<SugarParameter> _Parameters = new List<SugarParameter>();
|
public List<SugarParameter> _Parameters = new List<SugarParameter>();
|
||||||
|
@ -63,6 +63,7 @@ namespace SqlSugar
|
|||||||
this._Context.Insertable(item)
|
this._Context.Insertable(item)
|
||||||
.IgnoreColumns(_RootOptions.IgnoreColumns)
|
.IgnoreColumns(_RootOptions.IgnoreColumns)
|
||||||
.InsertColumns(_RootOptions.InsertColumns)
|
.InsertColumns(_RootOptions.InsertColumns)
|
||||||
|
.EnableDiffLogEventIF(_RootOptions.IsDiffLogEvent, _RootOptions.DiffLogBizData)
|
||||||
.ExecuteCommandIdentityIntoEntity();
|
.ExecuteCommandIdentityIntoEntity();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -166,6 +167,7 @@ namespace SqlSugar
|
|||||||
this._Context.Insertable(insertData)
|
this._Context.Insertable(insertData)
|
||||||
.IgnoreColumns(_RootOptions.IgnoreColumns)
|
.IgnoreColumns(_RootOptions.IgnoreColumns)
|
||||||
.InsertColumns(_RootOptions.InsertColumns)
|
.InsertColumns(_RootOptions.InsertColumns)
|
||||||
|
.EnableDiffLogEventIF(_RootOptions.IsDiffLogEvent, _RootOptions.DiffLogBizData)
|
||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1153,6 +1153,25 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return DeleteNav(this.Queryable<T>().Where(whereExpression).ToList());
|
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()
|
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||||
{
|
{
|
||||||
return UpdateNav(new List<T>() { data });
|
return UpdateNav(new List<T>() { data });
|
||||||
|
@ -769,6 +769,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return ScopedContext.DeleteNav(whereExpression);
|
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()
|
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||||
{
|
{
|
||||||
return ScopedContext.UpdateNav(data);
|
return ScopedContext.UpdateNav(data);
|
||||||
|
@ -12,6 +12,11 @@ namespace SqlSugar
|
|||||||
public bool ManyToManyIsDeleteA { get; set; }
|
public bool ManyToManyIsDeleteA { get; set; }
|
||||||
public bool ManyToManyIsDeleteB { get; set; }
|
public bool ManyToManyIsDeleteB { get; set; }
|
||||||
}
|
}
|
||||||
|
public class DeleteNavRootOptions
|
||||||
|
{
|
||||||
|
public bool IsDiffLogEvent { get; set; }
|
||||||
|
public object DiffLogBizData { get; set; }
|
||||||
|
}
|
||||||
public class InsertNavRootOptions
|
public class InsertNavRootOptions
|
||||||
{
|
{
|
||||||
public string[] IgnoreColumns { get; set; }
|
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>(T data) where T : class, new();
|
||||||
DeleteNavTaskInit<T, T> DeleteNav<T>(List<T> datas) 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>(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>(T data) where T : class, new ();
|
||||||
UpdateNavTaskInit<T, T> UpdateNav<T>(List<T> datas) 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();
|
UpdateNavTaskInit<T, T> UpdateNav<T>(T data,UpdateNavRootOptions rootOptions) where T : class, new();
|
||||||
|
@ -230,6 +230,20 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return this.Context.DeleteNav(whereExpression);
|
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()
|
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||||
{
|
{
|
||||||
return this.Context.UpdateNav(data);
|
return this.Context.UpdateNav(data);
|
||||||
|
@ -815,6 +815,21 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return ScopedContext.DeleteNav(whereExpression);
|
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()
|
public UpdateNavTaskInit<T, T> UpdateNav<T>(T data) where T : class, new()
|
||||||
{
|
{
|
||||||
return ScopedContext.UpdateNav(data);
|
return ScopedContext.UpdateNav(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user