mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 修复 聚合根仓储 InsertOrUpdate OneToMany 只插入一条记录的 bug;
This commit is contained in:
@ -53,7 +53,7 @@ namespace FreeSql
|
||||
bool LocalCanInsert(Type entityType, object entity, bool isadd)
|
||||
{
|
||||
var stateKey = rootRepository.Orm.GetEntityKeyString(entityType, entity, false);
|
||||
if (stateKey == null) return true;
|
||||
if (string.IsNullOrEmpty(stateKey)) return true;
|
||||
if (ignores.TryGetValue(entityType, out var stateKeys) == false)
|
||||
{
|
||||
if (isadd)
|
||||
|
@ -106,7 +106,7 @@ namespace FreeSql
|
||||
bool LocalCanInsert(Type entityType, object entity, bool isadd)
|
||||
{
|
||||
var stateKey = rootRepository.Orm.GetEntityKeyString(entityType, entity, false);
|
||||
if (stateKey == null) return true;
|
||||
if (string.IsNullOrEmpty(stateKey)) return true;
|
||||
if (ignores.TryGetValue(entityType, out var stateKeys) == false)
|
||||
{
|
||||
if (isadd)
|
||||
|
@ -151,12 +151,12 @@ namespace FreeSql
|
||||
foreach (var item in collectionBefore)
|
||||
{
|
||||
var key = fsql.GetEntityKeyString(elementType, item, false);
|
||||
if (key != null) dictBefore.Add(key, item);
|
||||
if (!string.IsNullOrEmpty(key)) dictBefore.Add(key, item);
|
||||
}
|
||||
foreach (var item in collectionAfter)
|
||||
{
|
||||
var key = fsql.GetEntityKeyString(elementType, item, false);
|
||||
if (key != null)
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
if (dictAfter.ContainsKey(key) == false)
|
||||
dictAfter.Add(key, item);
|
||||
|
Reference in New Issue
Block a user