Hi,
How can I change to nHibernate automatic open an transaction when
use Lazy Loading ?

Some i have a code some like this:

using (var s = session.OpenSession())
{
  User user = null;
  using (var tx = s.BeginTransaction()) {
    user = s.Get<User>(123);

    tx.Commit();
  }

  foreach (var f in user.Friends) { // Will hit the database, outside the
transaction
  }
}

but, my code its more complicated than that, i have an framework, and its
automatic
initialize the session and transaction and auto closes the transaction.

nHibernate can initialize a transaction on open session automatic when use
lazy load ?

--~--~---------~--~----~------------~-------~--~----~
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