Re: database access pattern

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
>
>
>
>
>


.



Relevant Pages

  • Re: real world singleton class example?
    ... I've used them for database classes before. ... What is the use of a singleton is when running PHP? ... table1 and table2 tables within the database. ...
    (comp.lang.php)
  • Re: real world singleton class example?
    ... I've used them for database classes before. ... What is the use of a singleton is when running PHP? ... table1 and table2 tables within the database. ...
    (comp.lang.php)
  • Re: real world singleton class example?
    ... I've used them for database classes before. ... What is the use of a singleton is when running PHP? ... table1 and table2 tables within the database. ...
    (comp.lang.php)
  • Re: Shall the environment be global?
    ... whole application access to the database. ... The preferences part of the ... The input part of the app needs to input data ... Right now I'm using a global singleton class which seems too simple and ...
    (comp.object)
  • C# programmer looking for a job
    ... Software Development including Desktop, Client/Server and Database ... Practical skills in object oriented design and design patterns ... XML, Oracle, CVS, VSS, Delphi, bug tracking. ... Developed in Delphi5; ...
    (misc.immigration.usa)