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