You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 5.0 version.
Session: How to Get Entity Counters
When a document is downloaded from the server, it contains various metadata information like ID or current change-vector.
If the document has Counters, all its counter names are also stored within the metadata in session.
They are available for each entity using the
GetCountersFor method from the
Advanced session operations.
List<string> GetCountersFor<T>(T instance);
|instance||T||Instance of an entity for which counter names will be returned.|
|List < string >||Returns the counter names for the specified entity, or
var employee = session.Load<Employee>("employees/1-A"); List<string> counterNames = session.Advanced.GetCountersFor(employee);