Open a session conforming to the given parameters. Used mainly for current session processing.

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

Syntax

C#
ISession OpenSession(
	IDbConnection connection,
	bool flushBeforeCompletionEnabled,
	bool autoCloseSessionEnabled,
	ConnectionReleaseMode connectionReleaseMode
)
Visual Basic
Function OpenSession ( _
	connection As IDbConnection, _
	flushBeforeCompletionEnabled As Boolean, _
	autoCloseSessionEnabled As Boolean, _
	connectionReleaseMode As ConnectionReleaseMode _
) As ISession
Visual C++
ISession^ OpenSession(
	IDbConnection^ connection, 
	bool flushBeforeCompletionEnabled, 
	bool autoCloseSessionEnabled, 
	ConnectionReleaseMode connectionReleaseMode
)

Parameters

connection
Type: System.Data..::..IDbConnection
The external ado.net connection to use, if one (i.e., optional).
flushBeforeCompletionEnabled
Type: System..::..Boolean
Should the session be auto-flushed prior to transaction completion?
autoCloseSessionEnabled
Type: System..::..Boolean
Should the session be auto-closed after transaction completion?
connectionReleaseMode
Type: NHibernate..::..ConnectionReleaseMode
The release mode for managed jdbc connections.

Return Value

An appropriate session.

See Also