Set the read-only mode for entities (and proxies) loaded by this query. This setting overrides the default setting for the session (see DefaultReadOnly).

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

Syntax

C#
IQuery SetReadOnly(
	bool readOnly
)
Visual Basic
Function SetReadOnly ( _
	readOnly As Boolean _
) As IQuery
Visual C++
IQuery^ SetReadOnly(
	bool readOnly
)

Parameters

readOnly
Type: System..::..Boolean
If true, entities (and proxies) loaded by the query will be read-only.

Return Value

this (for method chaining)

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.

When a proxy is initialized, the loaded entity will have the same read-only setting as the uninitialized proxy, regardless of the session's current setting.

The read-only setting has no impact on entities or proxies returned by the criteria that existed in the session before the criteria was executed.

See Also