Personally I don't know what you are talking about.You can have x
transactions inside the same nh-session.
session-per-request is a pattern well documented and with thousands of
examples.

In your code the first transaction is rolled-back because the transaction is
disposed without commit that mean rollback it.

When you don't know how manage transactions the most easy way to solve the
problem is saying:
"Clearly NHibernate breaks when using nested transactions though, so I'm
kind of stuck."

2009/10/19 acl123 <[email protected]>

>
> By the way I am using Session-Per-Web-Request as this appears to be
> the recommend way to use NHibernate with Asp .NET.
>
> This means that I definitely don't want to be wrapping the entire
> session in a transaction (the method that Ayende uses on his blog). I
> want to be using TransactionScope
> like you would use an NHibernate transaction - i.e. multiple
> transaction per session.
>
> Clearly NHibernate breaks when using nested transactions though, so
> I'm kind of stuck.
>
>
> On Oct 19, 12:59 pm, acl123 <[email protected]> wrote:
> > In this case, the second ADO command is committed to the database,
> > whilst the first is rolled back. What is going on? This seems very
> > weird to me.
> >
> > This is kind of a follow up question to my previous post here:
> http://groups.google.com/group/nhusers/browse_thread/thread/241cc0430...
> >
> >     [TestFixture]
> >     public class TestFixture
> >     {
> >             [Test]
> >             public void Test()
> >             {
> >                 using(var factory = _config.BuildSessionFactory())
> >                 {
> >                     using (var session = factory.OpenSession())
> >                     {
> >                         CallSessionContext.Bind(session);
> >
> >                         using(new TransactionScope())
> >                         {
> >                             using (session.BeginTransaction())
> >                             {
> >                                  // Do something with an NHibernate
> > mapped entity
> >                             }
> >
> >                             using(var connection = new SqlConnection
> > (_connectionString))
> >                             {
> >                                  // Execute an insert statement
> >                             }
> >                         }
> >
> >                         CallSessionContext.Unbind(factory);
> >                     }
> >                 }
> >             }
> >     }
> >
>


-- 
Fabio Maulo

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