mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Insert many to many
This commit is contained in:
parent
e5ceb95bc0
commit
7caf4a457f
@ -27,7 +27,7 @@ namespace SqlSugar
|
|||||||
.Where(it => it.PropertyName != mappingB.PropertyName)
|
.Where(it => it.PropertyName != mappingB.PropertyName)
|
||||||
.Where(it => it.IsPrimarykey && !it.IsIdentity && it.OracleSequenceName.IsNullOrEmpty()).FirstOrDefault();
|
.Where(it => it.IsPrimarykey && !it.IsIdentity && it.OracleSequenceName.IsNullOrEmpty()).FirstOrDefault();
|
||||||
Check.Exception(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
|
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)
|
foreach (var item in parentList)
|
||||||
{
|
{
|
||||||
var items= parentNavigateProperty.PropertyInfo.GetValue(item);
|
var items= parentNavigateProperty.PropertyInfo.GetValue(item);
|
||||||
@ -44,6 +44,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
SetMappingTableDefaultValue(mappingPk, keyValuePairs);
|
SetMappingTableDefaultValue(mappingPk, keyValuePairs);
|
||||||
}
|
}
|
||||||
|
mappgingTables.Add(keyValuePairs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ids = mappgingTables.Select(x => x[mappingA.DbColumnName]).ToList();
|
var ids = mappgingTables.Select(x => x[mappingA.DbColumnName]).ToList();
|
||||||
|
@ -10,8 +10,8 @@ namespace SqlSugar
|
|||||||
public class InsertNavTaskInit<Root, T> where T : class, new() where Root : class, new()
|
public class InsertNavTaskInit<Root, T> where T : class, new() where Root : class, new()
|
||||||
{
|
{
|
||||||
|
|
||||||
public SqlSugarProvider Context { get; set; }
|
internal SqlSugarProvider Context { get; set; }
|
||||||
public InsertNavProvider<Root, Root> insertNavProvider { get; set; }
|
internal InsertNavProvider<Root, Root> insertNavProvider { get; set; }
|
||||||
|
|
||||||
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, TChild>> expression) where TChild : class, new()
|
public InsertNavTask<Root, TChild> Include<TChild>(Expression<Func<Root, TChild>> expression) where TChild : class, new()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user