Hi guys,

I'm using PostgreSQL and Npgsql but I have isolated the issue to NHibernate 
behaviour. Here is the sample code which breaks, during the following code, 
we are already inside a Session and an ambient TranscationScope, then we 
nest like so:

var openSession = ObjectFactory.GetInstance<ISession>();
using (var trans = new TransactionScope(TransactionScopeOption.Suppress, new 
TransactionOptions { Timeout = new TimeSpan(0, 5, 0) })) {
    using (var newSession = sessionFactory.OpenStatelessSession(openSession.
Connection)) {
        using (var nhTrans = newSession.BeginTransaction()) {
            Stuff();
        }
    }
}

This code is operational using any NHib v4. But with any NHib Version v5+ 
it will throw the title exception 'Nested/Concurrent transactions aren't 
supported'. This is the case with any NpgSql 3+, making it likely that some 
behaviour of NHib changed (maybe correctly of course).

I have read the issues revolving around the configuration parameter 
'transaction.use_connection_on_system_prepare` and that doesn't help in 
this case. I find that in all cases, newSession.Connection.Connector == 
openSession.Connection.Connector and the NpgSql code has always checked 
against Connector.InTransaction before throwing, so NHibernate must be 
bypassing this somehow, although I can't see any evidence of that in the 
source code!

Anyone got any ideas why exactly this blows up in NHib v5+ only?

Thanks,

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to