DataAccessAdapter

Posts   
 
    
hommels
User
Posts: 23
Joined: 01-Jul-2005
# Posted on: 25-Jul-2005 20:17:47   

I am creating an AppInfo class that has a data access adapter declared in the members section like this private DataAccessAdapter _adapter = new DataAccessAdapter();

my question is should I hold onto this data access adapter during the life of the object or store a connection string and re-create/dispose of the dataadpter each time I reference an object of the class. Does it you alot of resources/ &/or permformance of the application.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Jul-2005 20:45:08   

Do it per action, so if you're saving a couple of entities in a routine, create an adapter instance and at the end of the routine, dispose it, similar to when you would use a transaction.

Creating a new DataAccessAdapter instance doesn't cost a lot of resources, almost nothing, it's very fast, so you shouldn't notice any delay at all.

Frans Bouma | Lead developer LLBLGen Pro