I'm seeing recommendations from NHProf/Ayende to do the following:

using(var session = sessionFactory.OpenSession())
using(var tx = session.BeginTransaction())
{
        var post = session.Get<Post>(1);
        // do something with post
        tx.Commit();
}

The issue with this is that it does not allow for lazy loading since the
session will be disposed when the method exits.

What is the proper usage for sessions?  The above code looks nice and tight,
however I am then not able to have lazy loading and would be forced to bring
back more from the database and my entities than I really need.

Tim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to