Best practices for accessing data????

  • Thread starter Thread starter William Gower
  • Start date Start date
W

William Gower

I have isolated all my data access into DALC classes ex. VendorDALC. I want
to allow for both SQL Server and MS Access databases. What is the best
practice for this? VendorSQLDALC and VendorOLEDALC? Or is there a better
way to do this? SQLHelper / OLEHelper and have VendorDALC call the
appropriate one depending on the database.
 
Well, "best" is a big word and depends on a lot. There's a neat new feature
in ADO.NET 2.0 that may interest you
http://weblogs.asp.net/britchie/archive/2004/05/16/132939.aspx
but that does little good now. This may help..
http://www.c-sharpcorner.com/Code/2002/July/GenericSQLParamDAComp.asp so
should this
http://www.c-sharpcorner.com/Code/2002/July/GenericDataAccessCompActivator.asp
It's two examples showing how to use a Factory Pattern to deal with this
situation.

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
 
Hi

You can use Mimer Provider Manager (Mpm), an open source product that
makes it possible to switch between databases without changing a single
line of code. Mpm is available at http://developer.mimer.com/mpm,
http://www.sourceforge.net/projects/mimerpm. Mpm does much more that
just hands out the right type of connection, for example it handles how
different databases used parameter markers. In your code you program
just as you are just to but against the Mpm-namspace, i.e MpmConnection,
MpmDataReader and so on. In you code you define what datasource you
should use and the definition of datasources is managed in the stand
alone Mimer Provider Manager administrator. This way you can swith
between different types of databases with a single click.

There are two articles about Mpm published at
http://www.codeproject.com/cs/database/MpmCodeproject.asp and
http://www.c-sharpcorner.com/Code/2004/March/MimerProviderManager.asp

Regards,
Fredrik
 
Back
Top