Thanks for the reply, Jason.

On Tue, Oct 5, 2010 at 11:06 AM, Jason Meckley <[email protected]> wrote:
> I have found TS to be finicky in an http enviornment. I believe it's
> related to threads and the http context. I removed the TS in favor or
> NH transactions and things worked as expected.

I would love to remove TS, but I don't think I can. As long as I'm
still using some of my legacy code (ADO Command,etc.), right?

> IIRC the session needs to open within the scope of TS otherwise the
> connection is not registered with the TS. The TS doesn't dispose of
> the session, but if it's opened within the TS, it should be disposed
> of before existing the TS.

Hmmm. Well, then do I have myself in a tight spot? Every page in this
web application will have the session that is created in the HTTP
module. For this situation, where I need to use TransactionScope,
should I create a _new_ session at this point in the code? Will
creating a new session, even though there is already an open session,
cause a problem? (Assuming I write the code as you have below)

> using(var scope = new TransactionScope())
> using(var session = factory.OpenSession())
> {
>   do work
>   scope.Complete();
> }

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