Re: database access pattern
- From: "Peter Rilling" <peter@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Jan 2006 15:46:52 -0800
Definitely #1 and I do not like your singleton idea. Really you only need
one instance of a DAL so a singleton would work well. I would not think you
would want the data access to reside in the base for all your classes. Part
of design is to isolate the data access part into its own area, then have
the other classes call methods that returns specific pieces of information.
"Val P" <ValP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:300B4421-9A26-4573-8360-8E57F16BDAB2@xxxxxxxxxxxxxxxx
> How does everyone design the database access layer in an asp.net
> application?
> Two options that come to mind is:
>
> 1. create a database class and instanciate it as needed, local to a
> function
> or
> 2. Provide database access in a base class from which all objects that
> need
> db access will inherit from.
>
> #1 seems wasteful for application that do frequent but light db access.
> Option #2 seems even more wasteful, because it adds overhead to the
> inheriting class creation, whether or not that class will do db access.
>
> The third option that I have been thinking about is a modification of 1,
> but
> make it as a singleton. Would that help any, or will it become a
> bottleneck?
>
> I'm just looking for pointers on best practives on implementing the
> database
> layer. I found some in MSDN, but they were more implementation related,
> rather than design related. I'd like to cut down on object creation, while
> at
> the same time keep throughput as high as possible. Creating a database
> class
> is usually expensive, since it involves retrieving a connection string,
> setting up multiple objects, etc...
>
> any ideas would be appreciated.
>
>
>
>
>
.
- Prev by Date: Problem Sending Email via a web page
- Next by Date: Unable to copy file
- Previous by thread: Problem Sending Email via a web page
- Next by thread: Re: database access pattern
- Index(es):
Relevant Pages
|