如何强制dbcontext刷新数据库中已删除的项目?

时间:2013-03-11 18:36:28

标签: entity-framework dbcontext

有没有办法强制EF DbContext正确刷新?

1) I remove an Entity with ID key='foo' from dbcontext
2) Call the SaveChanges() method
3) create a new Entity with the ID key='foo', add it to the context
4) try to SaveChanges() ==> failed ! Primary key violation 

0 个答案:

没有答案