SqlTransaction - SqlBulkCopy - Adapter

Posts   
 
    
luriaseo
User
Posts: 8
Joined: 04-Sep-2007
# Posted on: 03-Jun-2009 16:41:18   

Hi, actually I'm developing with LLBLGen, and I using Transactions.

this.objAdapter = new DataAccessAdapter();
            this.objAdapter.CommandTimeOut = 60;
            this.objAdapter.CatalogNameOverwrites = new CatalogNameOverwriteHashtable(CatalogNameUsage.ForceName);
this.objAdapter.StartTransaction(IsolationLevel.ReadCommitted, "ArchivoprocesadoencabezadoBase");
....
ActionProcedures.CargarTransaccionesTarjetas(-1, this.objAdapter);
....

But, I need to use SqlBulkCopy to insert data from a text plain file in a temporal table, the I use the sp "CargarTransaccionesTarjetas", to validate the content and process the data. But I need get the Transaction used in LLBLGen, to use as parameters to the SqlBulkCopy. Is there some way to do it ?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Jun-2009 08:15:39   

All stored procedure calls executed using a DataAccessAdaptor which has had transaction started on it will be run in the context of that transaction.

As discussed here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15859

And if you need to extract the Transaction to use it outside the context of LLBLGen Pro, then the DataAccessAdapter class has the PhysicalTransaction (IDBTransaction) property, but it's protected, so either derive from the DataAccessAdapter to expose it, or just use another partial class file to expose this property as shown here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15300

luriaseo
User
Posts: 8
Joined: 04-Sep-2007
# Posted on: 29-Jun-2009 22:27:35   

Walaa wrote:

All stored procedure calls executed using a DataAccessAdaptor which has had transaction started on it will be run in the context of that transaction.

As discussed here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15859

And if you need to extract the Transaction to use it outside the context of LLBLGen Pro, then the DataAccessAdapter class has the PhysicalTransaction (IDBTransaction) property, but it's protected, so either derive from the DataAccessAdapter to expose it, or just use another partial class file to expose this property as shown here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15300

Thanks ! I create a partial class to get the transaction, and used it at outside the context.