I am trying to get the following unit test to succeed:
using (var transaction = new TransactionScope())
using (var connection = new ConnectionScope()) // Alez Acheson's
implementation
{
var foo = NHSessionManager.CurrentSession.Linq<Foo>
.SetCachable
(true)
.OrderBy
(x => x.Name)
.ToList
()[0];
foo.Name = "testName";
var reloaded = NHSessionManager.CurrentSession.Linq<Foo>
.Where
(x => x.Name == "testName")
.FirstOrDefault
();
Assert.That(reloaded, Is.Not.Null);
}
The assert statement is always failing.
Looking at the generated SQL, I see two SELECT queries. The UPDATE
query is never executed.
Wrapping the method in an NHibernate transaction causes success:
using (var transaction = new TransactionScope())
using (var connection = new ConnectionScope()) // Alez Acheson's
implementation
using(var nhTransaction =
NHSessionManager.CurrentSession.BeginTransaction())
{
// Same code as above
}
Flush mode is set to auto.
I am performing similar operations throughout my code now, and in most
cases they succeed - just this one case it is failing.
What could be going wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---