NHibernate many to many and ISession.Close()?

You need to use the Session per Request pattern. See this link for an explanation of the best practices for using Nbernate with ASPX.

You need to use the Session per Request pattern. See this link for an explanation of the best practices for using N.

The simplest way is to use NInitialize (read here for details): using(ISession session = new SessionManager().GetSession()) { User user = session. Get(userId); NInitialize(user. Roles); return user; } However, sooner or later you would need to somehow manage the sessions in your application.

I recommend creating a data provider layer that would give you access to the database. The data provider layer will manage the creation and destruction of sessions. You could either have a session per request or per conversation (single ISession for the duration of an ASP.Net session).

The Summer Of Nbernate video series would be helpful. Session 5 and 13 are most relevant for you.

Sorry, but this is a bad advise. This way you destroy lazy loading and transaction isolation at the same time, while blowing up the code with lots of rubbish. – Stefan Steinegger Nov 3 '09 at 13:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions