I changed the bug today and encountered a strange problem. The entity object was clearly added to the collection, but List.Contains(entity); just didn't work.
Find a way to replace it temporarily
bool flag = list.Exists(o => o.Id == entity.Id);
if (!flag)
{
list.Add(entity);
}
Who has studied it and hopes to let me know.