Performance improvement on EnterpriseLibrary Instantiation

Topics: Data Access Application Block
Mar 10, 2011 at 2:27 PM

Hi All,

I am working on a .Net web application and I am using the Data Access Application block.

On each of my pages I am using the following to instantiate an abstract version of my database .

Database _db = EnterpriseLibraryContainer.Current.GetInstance("my_DB");

I was wondering is this a big performance hit on my application - and wouldn't I be better off creating a Public Static instance of the DB, that can be accessed throughout the app.

Is there any reason why I shouldn't go the proposed route?

Thanks,

Sinead

Mar 11, 2011 at 2:24 AM

Hi Sineadee,

As quoted from ctaveres here:

"Database is a cheap wrapper, they're trivial to create and don't take much time. It's much, much easier to simply create when needed and throw it away when done."

So basically, you are on the right track :). 

Mar 11, 2011 at 3:44 PM

Thankyou Daaberkads, nice to know I'm on the right track.