mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Update db.InsertNav
This commit is contained in:
parent
c5b29149e8
commit
90c4df5cc0
@ -18,6 +18,7 @@ namespace SqlSugar
|
||||
public SqlSugarProvider _Context { get; set; }
|
||||
public NavigateType? _NavigateType { get; set; }
|
||||
public bool IsFirst { get; set; }
|
||||
public InsertNavOptions _navOptions { get; set; }
|
||||
|
||||
public InsertNavProvider<Root, Root> AsNav()
|
||||
{
|
||||
@ -29,6 +30,18 @@ namespace SqlSugar
|
||||
_ParentPkColumn=this._Context.EntityMaintenance.GetEntityInfo<Root>().Columns.First(it=>it.IsPrimarykey)
|
||||
};
|
||||
}
|
||||
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T, TChild>> expression,InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
_navOptions = options;
|
||||
return _ThenInclude(expression);
|
||||
}
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T, List<TChild>>> expression, InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
_navOptions = options;
|
||||
return _ThenInclude(expression);
|
||||
}
|
||||
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T, TChild>> expression) where TChild : class, new()
|
||||
{
|
||||
return _ThenInclude(expression);
|
||||
|
@ -31,6 +31,25 @@ namespace SqlSugar
|
||||
result.Context = this.Context;
|
||||
return result;
|
||||
}
|
||||
|
||||
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, TChild>> expression,InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
this.Context = insertNavProvider._Context;
|
||||
InsertNavTask<Root, TChild> result = new InsertNavTask<Root, TChild>();
|
||||
Func<InsertNavProvider<Root, TChild>> func = () => insertNavProvider.ThenInclude(expression, options);
|
||||
result.PreFunc = func;
|
||||
result.Context = this.Context;
|
||||
return result;
|
||||
}
|
||||
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, List<TChild>>> expression, InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
this.Context = insertNavProvider._Context;
|
||||
InsertNavTask<Root, TChild> result = new InsertNavTask<Root, TChild>();
|
||||
Func<InsertNavProvider<Root, TChild>> func = () => insertNavProvider.ThenInclude(expression, options);
|
||||
result.PreFunc = func;
|
||||
result.Context = this.Context;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public class InsertNavTask<Root, T> where T : class, new() where Root : class, new()
|
||||
{
|
||||
@ -60,6 +79,36 @@ namespace SqlSugar
|
||||
{
|
||||
return AsNav().ThenInclude(expression);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public InsertNavTask<Root, TChild> ThenInclude<TChild>(Expression<Func<T, TChild>> expression,InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
InsertNavTask<Root, TChild> result = new InsertNavTask<Root, TChild>();
|
||||
Func<InsertNavProvider<Root, TChild>> func = () => PreFunc().ThenInclude(expression,options);
|
||||
result.PreFunc = func;
|
||||
result.Context = this.Context;
|
||||
return result;
|
||||
}
|
||||
public InsertNavTask<Root, TChild> ThenInclude<TChild>(Expression<Func<T, List<TChild>>> expression, InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
InsertNavTask<Root, TChild> result = new InsertNavTask<Root, TChild>();
|
||||
Func<InsertNavProvider<Root, TChild>> func = () => PreFunc().ThenInclude(expression, options);
|
||||
result.PreFunc = func;
|
||||
result.Context = this.Context;
|
||||
return result;
|
||||
}
|
||||
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, TChild>> expression, InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
return AsNav().ThenInclude(expression, options);
|
||||
}
|
||||
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, List<TChild>>> expression, InsertNavOptions options) where TChild : class, new()
|
||||
{
|
||||
return AsNav().ThenInclude(expression, options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool ExecuteCommand()
|
||||
{
|
||||
var hasTran = this.Context.Ado.Transaction != null;
|
||||
|
Loading…
Reference in New Issue
Block a user