HighTechTalks DotNet Forums  

Is a dbtransaction "open"?

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Is a dbtransaction "open"? in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bill Cohagan
 
Posts: n/a

Default Is a dbtransaction "open"? - 12-17-2005 , 06:30 PM






Is there a way to determine whether a transaction is still "open"; i.e., it
hasn't yet been either committed or rolled back? I'm guessing that the
transaction's connection object will be null if it is no longer in use, but
that's just a (hopefull) guess. I've got a situation where the code needs
to determine whether it can use an existing transaction or not, given only
the transaction object itself.

Thanks in advance,
Bill



Reply With Quote
  #2  
Old   
Miha Markic [MVP C#]
 
Posts: n/a

Default Re: Is a dbtransaction "open"? - 12-18-2005 , 07:57 AM






Hi Bill,

Why would you need it in first place?
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Bill Cohagan" <cohagan (AT) nospam (DOT) nospam> wrote

Quote:
Is there a way to determine whether a transaction is still "open"; i.e.,
it hasn't yet been either committed or rolled back? I'm guessing that the
transaction's connection object will be null if it is no longer in use,
but that's just a (hopefull) guess. I've got a situation where the code
needs to determine whether it can use an existing transaction or not,
given only the transaction object itself.

Thanks in advance,
Bill





Reply With Quote
  #3  
Old   
Bill Cohagan
 
Posts: n/a

Default Re: Is a dbtransaction "open"? - 12-20-2005 , 10:01 AM



Miha-

Well it's a bit of a long story, but...

I'm implementing a layered architecture, but also want to use lazy load in
my domain objects. In order to keep the domain objects decoupled from the
dataservice I supply each domain object with delegates responsible for
performing the actual fetch when lazy load is invoked. Now it may turn out
that the lazy load gets invoked inside an already existing (and "open" )
transaction in which case I'd like to use that transaction. If that
transaction has already been committed then the lazy load will proceed
without a transaction. The transaction object is captured (via a
WeakReference) in the environment of the delegate that is passed in -- so
I'm allowing for it to have been GC'd as well.

What I'm "lazy loading" are related objects, child sets, etc. Does that
explain it adequately?

Thanks,
Bill

"Miha Markic [MVP C#]" <miha at rthand com> wrote

Quote:
Hi Bill,

Why would you need it in first place?
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Bill Cohagan" <cohagan (AT) nospam (DOT) nospam> wrote in message
news:%23gm8eH2AGHA.360 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Is there a way to determine whether a transaction is still "open"; i.e.,
it hasn't yet been either committed or rolled back? I'm guessing that the
transaction's connection object will be null if it is no longer in use,
but that's just a (hopefull) guess. I've got a situation where the code
needs to determine whether it can use an existing transaction or not,
given only the transaction object itself.

Thanks in advance,
Bill







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.