mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update db.InsertNav
This commit is contained in:
@@ -31,7 +31,17 @@ namespace SqlSugar
|
||||
}
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T, TChild>> expression) where TChild : class, new()
|
||||
{
|
||||
return _ThenInclude(expression);
|
||||
}
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T, List<TChild>>> expression) where TChild : class, new()
|
||||
{
|
||||
return _ThenInclude(expression);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private InsertNavProvider<Root, TChild> _ThenInclude<TChild>(Expression<Func<T, TChild>> expression) where TChild : class, new()
|
||||
{
|
||||
var name = ExpressionTool.GetMemberName(expression);
|
||||
if (this._ParentEntity == null)
|
||||
{
|
||||
@@ -61,7 +71,8 @@ namespace SqlSugar
|
||||
}
|
||||
return GetResult<TChild>();
|
||||
}
|
||||
public InsertNavProvider<Root, TChild> ThenInclude<TChild>(Expression<Func<T,List<TChild>>> expression) where TChild : class, new()
|
||||
|
||||
private InsertNavProvider<Root, TChild> _ThenInclude<TChild>(Expression<Func<T, List<TChild>>> expression) where TChild : class, new()
|
||||
{
|
||||
var name = ExpressionTool.GetMemberName(expression);
|
||||
if (this._ParentEntity == null)
|
||||
@@ -70,8 +81,8 @@ namespace SqlSugar
|
||||
IsFirst = true;
|
||||
}
|
||||
var nav = this._ParentEntity.Columns.FirstOrDefault(x => x.PropertyName == name);
|
||||
;
|
||||
|
||||
;
|
||||
|
||||
if (nav.Navigat == null)
|
||||
{
|
||||
Check.ExceptionEasy($"{name} no navigate attribute", $"{this._ParentEntity.EntityName}的属性{name}没有导航属性");
|
||||
|
@@ -16,4 +16,9 @@ namespace SqlSugar
|
||||
public bool ManyToManyIsUpdateA { get; set; }
|
||||
public bool ManyToManyIsUpdateB { get; set; }
|
||||
}
|
||||
|
||||
public class InsertNavOptions
|
||||
{
|
||||
public bool OneToManyIfExistsNoInsert { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user