Lazy loading with NHibernate Castle Facility?

Yes, always dispose the ISession See the docs on ISessionManager usage.

Yes, always dispose the ISession. See the docs on ISessionManager usage. For transactions, consider using the Automatic Transaction Facility.

The SessionManager is ATM-aware so it will dispose the ISession smartly when it needs to, taking transactions into account, even when you apparently have disposed the ISession. Here's a quick & dirty sample app that uses ASP. NET MVC + Castle Automatic Transaction Facility + Nbernate facility.

– Daniel A. White Jul 13 '09 at 23:22 What you really need is some sample code. See svn.castleproject.

Org:8080/svn/castle/trunk/Samples/MindDump and the tests: svn.castleproject. Org:8080/svn/castle/trunk/Facilities/… – Mauricio Scheffer Jul 14 '09 at 1:48 Can you point me to a file that shows lazy loading functioning? – Daniel A.

White Jul 15 '09 at 22:00 1 do you have the sessionwebmodule registered? Mail-archive.Com/castle-project-users@googlegroups. Com/… – Mauricio Scheffer Jul 16 '09 at 4:45 Yep.

It should be there. – Daniel A. White Jul 16 '09 at 12:10.

We use transactions with using statements to handle the disposing. Public void Save(K entity) { if (entity == null) throw new ArgumentNullException("item", "The item being saved cannot be null. "); using (ISession session = GetSession()) { using (ITransaction tx = session.

BeginTransaction()) { session. SaveOrUpdate(entity); tx.Commit(); } } } I will still get the lazy loading error if I am accessing objects after making a modification in the same action. I have fixed the error by not accessing the objects after a save.

Here's an explination: stackoverflow.com/questions/1125988/nhib... I believe it is due to not saving the hierarchy correctly. I haven't tested it, but maybe saving the parent objects if you wish to access them will fix the issue. Simply putting the information I needed to access after the save into local variables before the save seemed to correct my issue.

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