C# Class RecruitmentWeb.NHibernateSessionModule

Implements the Open-Session-In-View pattern using NHibernateSessionManager. Assumes that each HTTP request is given a single transaction for the entire page-lifecycle. Inspiration for this class came from Ed Courtenay at http://sourceforge.net/forum/message.php?msg_id=2847509.
Inheritance: IHttpModule
Show file Open project: ucdavis/Recruitments

Public Methods

Method Description
Dispose ( ) : void
Init ( System.Web.HttpApplication context ) : void

Private Methods

Method Description
BeginTransaction ( object sender, EventArgs e ) : void

Opens a session within a transaction at the beginning of the HTTP request. This doesn't actually open a connection to the database until needed.

CloseSession ( object sender, EventArgs e ) : void

Closes a session without commiting the transaction

CommitAndCloseSession ( object sender, EventArgs e ) : void

Commits and closes the NHibernate session provided by the supplied NHibernateSessionManager. Assumes a transaction was begun at the beginning of the request; but a transaction or session does not *have* to be opened for this to operate successfully.

OpenSession ( object sender, EventArgs e ) : void

Makes sure that there is an open session by either grabbing and discarding an existing session, or creating a new one if there isn't one already

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Init() public method

public Init ( System.Web.HttpApplication context ) : void
context System.Web.HttpApplication
return void