Browse Source
Refactor handling of OriginalValue in AbpEntityEntry
pull/23329/head
maliming
1 year ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
3 additions and
7 deletions
-
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ChangeTrackers/AbpEntityEntry.cs
|
|
|
@ -48,9 +48,7 @@ public class AbpEntityEntry |
|
|
|
|
|
|
|
if (navigationEntry.NavigationEntry is CollectionEntry) |
|
|
|
{ |
|
|
|
navigationEntry.OriginalValue ??= new List<object>(); |
|
|
|
var ls = navigationEntry.OriginalValue.As<List<object>>(); |
|
|
|
ls.AddIfNotContains(entityEntry.Entity); |
|
|
|
navigationEntry.OriginalValue!.As<List<object>>().Add(entityEntry.Entity); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -75,11 +73,9 @@ public class AbpNavigationEntry |
|
|
|
{ |
|
|
|
NavigationEntry = navigationEntry; |
|
|
|
Name = name; |
|
|
|
if (navigationEntry.CurrentValue != null) |
|
|
|
if (navigationEntry.CurrentValue != null ) |
|
|
|
{ |
|
|
|
OriginalValue = navigationEntry is CollectionEntry collection |
|
|
|
? collection.CurrentValue!.Cast<object>().ToList() |
|
|
|
: navigationEntry.CurrentValue; |
|
|
|
OriginalValue = navigationEntry is CollectionEntry ? new List<object>() : navigationEntry.CurrentValue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|