Extending DAAB

Topics: Building and extending application blocks, Data Access Application Block
Feb 21, 2011 at 10:32 PM

Hello.

I want to extend the DAAB so it can support Accessors inside transactions. 
I did it modifying the code, but I was thinking if there is another way of doing this without having to modify the DAAB code, but rather extending or inheriting the code.. 

Feb 22, 2011 at 2:55 AM

As far as I know Accessors are supported if TransactionScope is the one you're going to use (see documentation for reference). I'm just not sure what are the specific requirements that opts you to modify the DAAB code.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Feb 22, 2011 at 3:57 AM

I missed that part in the documentation! thank you for pointing it out! it'll make my code way cleaner!!

I was going to use the DbTransaction that some methods (ExecuteReader, for example)  takes, and since the accessor won't take them, I was planning on creating my own version of the accessor that takes a DbTransaction.. 

The only thing that I don't understand fully is how can I do a rollback on a TransactionScope?

is that handled if some exception gets thrown inside the using?

 

Thanks,

 

Nicolas.

Feb 22, 2011 at 5:06 AM

Yes, it will be rollback if there are exception raised inside the using statement of the TransactionScope. Also TransactionScope's Complete method should also need to be called before the dispose happens.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com