Insert many to many

This commit is contained in:
sunkaixuan 2022-07-04 10:27:49 +08:00
parent e5ceb95bc0
commit 7caf4a457f
2 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace SqlSugar
.Where(it => it.PropertyName != mappingB.PropertyName)
.Where(it => it.IsPrimarykey && !it.IsIdentity && it.OracleSequenceName.IsNullOrEmpty()).FirstOrDefault();
Check.Exception(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
List<Dictionary<object, object>> mappgingTables = new List<Dictionary<object, object>>();
List<Dictionary<string, object>> mappgingTables = new List<Dictionary<string, object>>();
foreach (var item in parentList)
{
var items= parentNavigateProperty.PropertyInfo.GetValue(item);
@ -44,6 +44,7 @@ namespace SqlSugar
{
SetMappingTableDefaultValue(mappingPk, keyValuePairs);
}
mappgingTables.Add(keyValuePairs);
}
}
var ids = mappgingTables.Select(x => x[mappingA.DbColumnName]).ToList();

View File

@ -10,8 +10,8 @@ namespace SqlSugar
public class InsertNavTaskInit<Root, T> where T : class, new() where Root : class, new()
{
public SqlSugarProvider Context { get; set; }
public InsertNavProvider<Root, Root> insertNavProvider { get; set; }
internal SqlSugarProvider Context { get; set; }
internal InsertNavProvider<Root, Root> insertNavProvider { get; set; }
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, TChild>> expression) where TChild : class, new()
{