Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
该Table<TEntity>.DeleteOnSubmit方法有以下描述:
Table<TEntity>.DeleteOnSubmit
Puts an entity from this table into a pending delete state.
如何清除此挂起的删除状态?
如果您没有使用从上下文中检索到的任何对象,您应该能够简单地设置DbContext并null创建一个新对象,这可能是重置更改的最干净的方法。
DbContext
null
如果您正在使用检索到的对象并将其设置null为不是一个选项,那么您可以循环db.GetChangeSet().Deletes并调用.Clear()它们。
db.GetChangeSet().Deletes
.Clear()