Automatically running a command when a connection is opened

Topics: Data Access Application Block
May 5, 2008 at 2:51 PM
We are using the DAL from EntLib against an informix database and would like to run a command ("SET LOCK MODE TO WAIT 20") each time a connection is opened, initially I tried overriding CreateConnection to simply open the connection and then run the command, unfortunately this results in other code blowing up due to the internal method GetNewOpenConnection in Databases.cs blindly opening the connection after CreateConnection without checking if its already open. Unfortunately since GetNewOpenConnection is private internal I can't override it.

Is there an elegant solution to my problem or will I have to modify the EntLib source code to achieve what I want?

Thanks in advance,