Adapter constructor for a transaction

Posts   
 
    
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 21-Mar-2006 16:29:32   

Hi there,

Maybe I am missing something, but I cannot see a way to hand an open connection or a transaction to an adapter in the adapter scenario. The reason I am asking this is that I need to call LLBLGen components from non-LLBLGen components (yep, such components exist!!!) and the caller already has a transaction running. The non-LLBLGen component will need to retain control over the transaction. Would it not be possible to do the following: - Non-LLBLGen component opens a connection and starts a transaction - Adapter constructor with a transaction will be called by Non-LLBLGen component - the adapter executes some LLBLGen code - the non-LLBLGen component commits the transaction and closes the connection.

Thank you inadvance for your thoughts on this issue!

Best regareds

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 22-Mar-2006 03:19:54   

Are you refering to an ADO.NET transaction or COM+?

eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 22-Mar-2006 09:26:20   

It is an ado.net transaction, not a com+!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39909
Joined: 17-Aug-2003
# Posted on: 22-Mar-2006 11:30:20   
  • Derive a class from DataAccessAdapter
  • in there add 2 properties: one for your own connection to set and one for your own transaction to set.
  • override CreateNewPhysicalConnection and CreateNewPhysicalTransaction.
  • in those overrides, check the properties you added. If these are null, simply return the value returned by the base' method. If they're set, return the value of the property.
  • viola simple_smile
Frans Bouma | Lead developer LLBLGen Pro
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 22-Mar-2006 16:02:57   

Dear Otis,

thank you very much for your reply!