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 of an entity for which counter names will be returned.
|List < string >
||Returns the counter names for the specified entity, or
null if the entity has no counters. Throws an exception if the
instance is not tracked by the session.
var employee = session.Load<Employee>("employees/1-A");
List<string> counterNames = session.Advanced.GetCountersFor(employee);