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

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

Syntax

C#
public void SetReadOnly(
	Object entityOrProxy,
	bool readOnly
)
Visual Basic
Public Sub SetReadOnly ( _
	entityOrProxy As Object, _
	readOnly As Boolean _
)
Visual C++
public:
virtual void SetReadOnly(
	Object^ entityOrProxy, 
	bool readOnly
) sealed

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.

Implements

ISession..::..SetReadOnly(Object, Boolean)

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