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