-
Notifications
You must be signed in to change notification settings - Fork 669
Open
Description
Hi,
I've recently encountered a problem causing throwing an InvalidOperationException showed below.
System.InvalidOperationException: Failed to compare two elements in the array.
---> System.ArgumentException: At least one object must implement IComparable.
at System.Collections.Comparer.Compare(Object a, Object b)
at System.Collections.Generic.ObjectComparer`1.Compare(T x, T y)
at Microsoft.EntityFrameworkCore.Update.Internal.ModificationCommandComparer.Compare(ModificationCommand x, ModificationCommand y)
The problem occurs when EntityFramework's SaveChangesAsync() method is called after removing a few objects from the property of type List of some Entity. I've tried Remove(object), RemoveAt(index) and RemoveAll(lambdaExpression) methods. The solution was to implement IComparable interface to TypedIdValueBase class.
Metadata
Metadata
Assignees
Labels
No labels