entity framework core 更新问题
DMPX 2016-06-26 06:38:48 InvalidOperationException: The instance of entity type 'User' cannot be tracked because another instance of this type with the same key is already being tracked. When adding new entities, for most key types a unique temporary key value will be created if no key is set (i.e. if the key property is assigned the default value for its type). If you are explicitly setting key values for new entities, ensure they do not collide with existing entities or temporary values generated for other new entities. When attaching existing entities, ensure that only one entity instance with a given key value is attached to the context.
获取User对象
_unitOfWork.Set<TEntity>().SingleOrDefault(filter);
更新User对象
base.Entry<TEntity>(item).State = EntityState.Modified;
ef4.0时有base.Entry<TEntity>(original).CurrentValues.SetValues(current);
ef core 找不到CurrentValues了