Skip to content

PersistenceContext EntityEntries Delete and Flush #3245

Answered by fredericDelaporte
danspam asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, a gone entity is removed from the persistence context. See EntityDeleteAction.

IPersistenceContext persistenceContext = session.PersistenceContext;
EntityEntry entry = persistenceContext.RemoveEntry(instance);
if (entry == null)
{
throw new AssertionFailure("Possible nonthreadsafe access to session");
}
entry.PostDelete();

EntityEntry.PostDelete is the only thing that does affect the Gone status, and that is the only place where it is called. As you can see, it is called after removing the entry from the context.

The Gone status is useful for NHib…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danspam
Comment options

Answer selected by danspam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants