Entity Framework: Generic compare type without Id?
问题 Is there anyway to do a comparison between objects for equality generically without objects having an ID? I am trying to do a typical generic update, for which I have seen many examples of online, but they all usually look something like this: public void Update(TClass entity) { TClass oldEntity = _context.Set<TClass>().Find(entity.Id); foreach (var prop in typeof(TClass).GetProperties()) { prop.SetValue(oldEntity, prop.GetValue(entity, null), null); } } or something similar.The problem with