Change the read-only status of an entity (or proxy).

Namespace: NHibernate
Assembly: NHibernate (in NHibernate.dll) Version: 3.2.0.4000 (3.2.0.4000)

Syntax

C#
void SetReadOnly(
	Object entityOrProxy,
	bool readOnly
)
Visual Basic
Sub SetReadOnly ( _
	entityOrProxy As Object, _
	readOnly As Boolean _
)
Visual C++
void SetReadOnly(
	Object^ entityOrProxy, 
	bool readOnly
)

Parameters

entityOrProxy
Type: System..::..Object
An entity (or INHibernateProxy).
readOnly
Type: System..::..Boolean
If true, the entity or proxy is made read-only; if false, it is made modifiable.

Remarks

Read-only entities can be modified, but changes are not persisted. They are not dirty-checked and snapshots of persistent state are not maintained.

Immutable entities cannot be made read-only.

To set the default read-only setting for entities and proxies that are loaded into the session, see DefaultReadOnly.

This method a facade for SetReadOnly(Object, Boolean).

See Also