I think I might be going a bit insane staring at this for a while, so
coming here to get set straight. Here's what I'm seeing:
When NHibernate participates in a distributed transaction (eg
TransactionScope) and the NHibernate transaction commits, but the
TransactionScope rolls back, the 2nd level cache gets out of sync (it
has cached the data from the NHibernate transaction). Is this
expected? Is there a way to configure NHibernate to get around this?
If it's expected, that's fine, I can just deal w/ it rather than
trying to force it to work.
Here's a bit of a contrived example but hopefully makes the point:
using (var scope = new TransactionScope()
{
using (var session = NHibernateSessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{
var thing = session.Get<Thing>(id);
thing.Prop = true;
transaction.Commit();
}
// no scope.Complete so will rollback
}
using (var session = NHibernateSessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{
var thing = session.Get<Thing>(id);
Assert.IsFalse(thing.Prop); // <-- Prop is true!
}
Thanks
--
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.