Re: Pros n Cons - One class to hold all Data Access Method?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Kevin Spencer (kevin_at_takempis.com)
Date: 03/16/04


Date: Tue, 16 Mar 2004 17:32:11 -0500

It is an assembly of (in our case) static methods, which can perform various
operations on a Database without being specific about what database, table,
etc. that they are working with. For example, we have methods which return a
DataTable from a query, a DataTable from a Stored Procedure, a DataReader
from a query, a DataReader from a Stored Procedure, etc. It also includes
methods for opening and closing Connections, and other typical database
operations. Our methods that return disconnected data, such as DataTables
and DataaSets, open and close their own Connections, while methods that work
with DataReaders receive a reference to a Connection and Command, and return
the DataReader. The calling class must then close the Connection by passing
it to another static method which receives a reference to the Connection and
closes it.

Our business classes employ these methods to work with the data they need,
and then manipulate it according to their functionality.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"TJS" <nospam@here.com> wrote in message
news:uJ0W2P6CEHA.3928@TK2MSFTNGP09.phx.gbl...
> how does one derive /define a generic Data Access Layer ?
>
>
> "Kevin Spencer" <kevin@takempis.com> wrote in message
> news:epWBlx4CEHA.3064@tk2msftngp13.phx.gbl...
> > IMHO, this is not entirely extensible. I would suggest a further
> separation.
> > Put generic Data Access methods into a single class. Create business
> classes
> > that work with the specific database that your app is currently working
> > with. The business classes interact with the Data Access class to manage
> > their data. Then, later, if you need to write another app that works
with
> a
> > different data source, you still have the generic Data Access class to
> > provide the lower-level functionality, and you merely build a different
> > business class(es) on top of that.
> >
> > -- 
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "rafey" <a@b.com> wrote in message
> > news:u#Gj9G2CEHA.1604@TK2MSFTNGP11.phx.gbl...
> > > Hello,
> > >
> > > We are developing ASP.NET / VB.NET database application. We have one
> > design
> > > suggestion as stated below:
> > >
> > > What are the Pros n Cons of having ONE and ONLY ONE class to hold all
> Data
> > > Access Method? Or
> > >
> > > What are the advantages or disadvantages of following design:
> > >
> > > ONE class that will contain ALL DAL (Data Access Layer) methods for
> > complete
> > > SQL Server Pubs database, for example.
> > >
> > > That ONE class will contain Insert, Update, Delete and select method
for
> > all
> > > tables in Pubs database. This class may have hundreds to Select from
> Pubs
> > > database in various ways. We have following concerns for this design:
> > >
> > > 1- Resource Usage
> > > 2- Transaction
> > > 3- Code Reusability
> > > 4- Security
> > >
> > > Please write if there are any advantages or disadvantages of this
> design.
> > >
> > > Regards,
> > > Rafey
> > >
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: Communicating over the internet
    ... > That way you provide one manner in which to open the database, ... > can keep the connection open and then when someone wants to ... > server as the database and the soap dll connecting with a TCP socket. ... The name of the running program might help. ...
    (microsoft.public.vb.general.discussion)
  • Re: ADO Connection Timeout
    ... much rather write stored procedures and use server side cursors. ... local database, it is vital that I get the information to a central server. ... Once the connection is restored, ...
    (microsoft.public.data.ado)