Session: How to get entity url?

GetDocumentUrl is a method in Advanced session operations that returns full url for a given entity.

Syntax

string GetDocumentUrl(object entity);
Parameters
entity object Instance of an entity for which url will be returned.
Return Value
string Full url for a given entity.

Example

Employee employee = session.Load<Employee>("employees/1");
// http://localhost:8080/databases/Northwind/docs/employees/1
string url = session.Advanced.GetDocumentUrl(employee);

Remarks

If the entity is transient (not attached) this method will throw InvalidOperationException.