Re: Pros n Cons - One class to hold all Data Access Method?
From: Kevin Spencer (kevin_at_takempis.com)
Date: 03/16/04
- Next message: Charles Law: "Re: UCOMIStream, MSHTML and WebBrowser control Persistence Problem"
- Previous message: Herfried K. Wagner [MVP]: "Re: Assembly"
- In reply to: TJS: "Re: Pros n Cons - One class to hold all Data Access Method?"
- Next in thread: Jeremy: "Re: Pros n Cons - One class to hold all Data Access Method?"
- Messages sorted by: [ date ] [ thread ]
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 > > > > > > > > > > > > > > >
- Next message: Charles Law: "Re: UCOMIStream, MSHTML and WebBrowser control Persistence Problem"
- Previous message: Herfried K. Wagner [MVP]: "Re: Assembly"
- In reply to: TJS: "Re: Pros n Cons - One class to hold all Data Access Method?"
- Next in thread: Jeremy: "Re: Pros n Cons - One class to hold all Data Access Method?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|