What happen if you begin a NH's transaction (repeat a transaction of NH)
after open each session ?
Try to execute each save inside the corresponding NH's transaction and let
me know what happen.

2009/10/15 Mike Nichols <[email protected]>

>
> This test fails. Within a single transaction, there may be multiple
> sessions trying to persist to different databases but I am not sure
> this is possible.
> I lifted the ForceEscalationToDistributedTx from NH DTC tests and it
> enlists itself to rollback the transaction.
> Is what I am trying to do here possible?
> [Observation]
> public void should_not_succeed_in_persisting()
> {
>
>        var tx = new TransactionScope();
>        var s1 = SessionFactory1.OpenSession();
>        var s2 = SessionFactory2.OpenSession();
>        s1.FlushMode = FlushMode.Commit;
>        s2.FlushMode = FlushMode.Commit;
>        s1.Save(new MyEntity1()
>        {
>                Agency = "ADOT",
>        });
>        s2.Save(new MyEntity2()
>        {
>                Agency = "ADOT",
>        });
>        new ForceEscalationToDistributedTx(true);
>
>        tx.Complete();
>        try
>        {
>
>                tx.Dispose();
>
>                throw new InvalidOperationException("Expected tx abort");
>        }
>        catch (TransactionAbortedException)
>        {
>                //expected
>        }
>        s1.Dispose();
>        s2.Dispose();
>        using(var s=SessionFactory1.OpenSession())
>        {
>                var pm = s.CreateCriteria(typeof
> (StandardSpecificationsPublicationPM)).List();
>                Assert.Equal(0, pm.Count);
>        }
> }
> ////////////////////////////END TEST////////////////////////////
>
> >
>


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