You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 5.1 version.
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.
const employee = new Employee(); employee.firstName = "John"; employee.lastName = "Doe"; await session.store(employee); session.advanced.clear(); await session.saveChanges(); // nothing will hapen