Session: How to mark entity as readonly?
Entities can be marked as read-only using
MarkReadOnly. This operation is equal to adding to entity metadata a key
Raven-Read-Only with value set to
Implications of setting entity as read-only are as follows:
- change tracking won't apply to such entity
- forcing updates or deletes (e.g. using
Commands) will throw
void MarkReadOnly(object entity);
||Instance of an entity that will be marked as read-only.
Employee employee = session.Load<Employee>("employees/1");