Wrap the nhibernate transaction in a custom class BusinessTransaction
or something, when there is a need to create transaction set isowner
field to true or something.

Later on you can use this on commit to know whether you need a flush
or a commit(isowner is true)

Regards

On Jan 15, 5:48 pm, Will Shaver <[email protected]> wrote:
> If you are using Rhino-Tools - or would consider using it - there is a lot
> of work in there for the UnitOfWork pattern. Specifically review the
> LongConversationManager.cs and the UnitOfWork.cs files. These allow you to
> have multiple concurrent conversations going for the same user, which can be
> very useful in ajax settings.
>
>
>
> On Thu, Jan 15, 2009 at 6:59 AM, Tuna Toksöz <[email protected]> wrote:
> > Check Fabios blog athttp://fabiomaulo.blogspot.com
>
> > Tuna Toksöz
> >http://tunatoksoz.com
>
> > Typos included to enhance the readers attention!
>
> > On Thu, Jan 15, 2009 at 12:28 PM, Stuart Campbell <
> > [email protected]> wrote:
>
> >> What's the recommended way to support nested transactions in NH?
>
> >> Basically, I'm using session-per-request and my repository methods wrap
> >> all calls in a transaction like this...
>
> >> var tran = session.BeginTransaction();
> >> try
> >> {
> >>     // do work here
>
> >>     tran.Commit();
> >> }
> >> catch
> >> {
> >>     tran.Rollback();
> >>     throw;
> >> }
>
> >> But I also want multiple repository calls to be contained in a logical
> >> "business" transaction, like this (note that all repositories expose
> >> BeginTransaction which returns an ITransaction wrapper):
>
> >> var outerTran = accountRepository.BeginTransaction();
> >> try
> >> {
> >>     accountRepository.Save(account);
>
> >>     notificationRepository.Save(notification);
>
> >>     outerTran.Commit();
> >> }
> >> catch
> >> {
> >>     outerTran.Rollback();
> >>     throw;
> >> }
>
> >> This doesn't work because outerTran reports that it has been committed as
> >> soon as the first Save() operation commits. I'm obviously missing something
> >> fundamental here and would be grateful if someone could point me in the
> >> right direction.
>
> >> If I have some time today I'll try looking through the NH code to try and
> >> understand the internals better. In the meantime any pointers would be
> >> welcome.
>
> >> thanks
>
> >> Stu- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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