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