Add InsertNav(+2)

This commit is contained in:
sunkaixuan
2022-10-24 09:11:37 +08:00
parent fe8a9cda76
commit adbf0ad3eb
7 changed files with 46 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ namespace SqlSugar
{
public partial class InsertNavProvider<Root,T> where T : class,new() where Root:class,new()
{
public InsertNavRootOptions _RootOptions { get; set; }
public List<Root> _Roots { get; set; }
public List<object> _ParentList { get; set; }
public List<object> _RootList { get; set; }

View File

@@ -905,6 +905,20 @@ namespace SqlSugar
result.insertNavProvider = provider;
return result;
}
public InsertNavTaskInit<T, T> InsertNav<T>(T data, InsertNavRootOptions rootOptions) where T : class, new()
{
return InsertNav(new List<T>() { data },rootOptions); ;
}
public InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas, InsertNavRootOptions rootOptions) where T : class, new()
{
var result = new InsertNavTaskInit<T, T>();
var provider = new InsertNavProvider<T, T>();
provider._Roots = datas;
provider._Context = this;
provider._RootOptions = rootOptions;
result.insertNavProvider = provider;
return result;
}
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data) where T : class, new()
{
return DeleteNav(new List<T>() { data });

View File

@@ -689,6 +689,14 @@ namespace SqlSugar
{
return ScopedContext.InsertNav(datas);
}
public InsertNavTaskInit<T, T> InsertNav<T>(T data,InsertNavRootOptions rootOptions) where T : class, new()
{
return ScopedContext.InsertNav(data,rootOptions);
}
public InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas, InsertNavRootOptions rootOptions) where T : class, new()
{
return ScopedContext.InsertNav(datas,rootOptions);
}
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data) where T : class, new()
{
return ScopedContext.DeleteNav(data);

View File

@@ -17,6 +17,11 @@ namespace SqlSugar
public string IgnoreColumns { get; set; }
public string[] UpdateColumns { get; set; }
}
public class InertNavRootOptions
{
public string IgnoreColumns { get; set; }
public string[] InsertColumns { get; set; }
}
public class UpdateNavRootOptions
{
public string IgnoreColumns { get; set; }

View File

@@ -209,6 +209,8 @@ namespace SqlSugar
#region Nav CUD
InsertNavTaskInit<T, T> InsertNav<T>(T data) where T : class, new();
InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas) where T : class, new();
InsertNavTaskInit<T, T> InsertNav<T>(T data,InsertNavRootOptions rootOptions) where T : class, new();
InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas, InsertNavRootOptions rootOptions) 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>(Expression<Func<T,bool>> whereExpression) where T : class, new();

View File

@@ -198,6 +198,14 @@ namespace SqlSugar
{
return this.Context.InsertNav(datas);
}
public InsertNavTaskInit<T, T> InsertNav<T>(T data, InsertNavRootOptions rootOptions) where T : class, new()
{
return this.Context.InsertNav(data, rootOptions);
}
public InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas, InsertNavRootOptions rootOptions) where T : class, new()
{
return this.Context.InsertNav(datas, rootOptions);
}
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data) where T : class, new()
{
return this.Context.DeleteNav(data);

View File

@@ -745,6 +745,14 @@ namespace SqlSugar
{
return ScopedContext.InsertNav(datas);
}
public InsertNavTaskInit<T, T> InsertNav<T>(T data, InsertNavRootOptions rootOptions) where T : class, new()
{
return ScopedContext.InsertNav(data, rootOptions);
}
public InsertNavTaskInit<T, T> InsertNav<T>(List<T> datas, InsertNavRootOptions rootOptions) where T : class, new()
{
return ScopedContext.InsertNav(datas, rootOptions);
}
public DeleteNavTaskInit<T, T> DeleteNav<T>(T data) where T : class, new()
{
return ScopedContext.DeleteNav(data);