Session: How to Clear a Session
To clear session state, stop tracking entities, and remove all pending commands,
use the Clear
method from the Advanced
session operations.
Syntax
void Clear();
Example
session.Store(new Employee
{
FirstName = "John",
LastName = "Doe"
});
session.Advanced.Clear();
session.SaveChanges(); // nothing will happen