You are currently browsing legacy 5.0 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: How to Clear a Session

To clear session state, to stop tracking entities and remove all pending commands, etc. the Clear method is used from the Advanced session operations.


void Clear();


session.Store(new Employee
    FirstName = "John",
    LastName = "Doe"


session.SaveChanges(); // nothing will happen