BaseClass

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I am writing (or trying to write) a base class which will be used for all
my Database access.

I have created a base class which implement the IDbCommand, IDbDataAdapter,
IDbDataParameter methods, where this class is creating the specif type of
Command (Sql, OLDB, etc.) and returning the appropriate "ID" object.

My current "design issue" is how to properly handle the DbTypes. Not all
of the SQLDbTypes translate into DbTypes and likewise for OleDbTypes. At
some point the application calling my "base" will have to provide me with a
"SqlDbType" or an "OleDbType" to create a parm for that specific database.
Is that correct, or is ther another way around this issue?

What ever calls my base class would have to undergo some sort of change
if/when a changed was ever made between "the current" data and a new
database.

Should I desgn my base class to handle these type of issues or should I
have yet another class handle the "Database specific" issues?
 
I had the same issue and found that there was no common way to handle data
types in a generic way :( . I ended up writing a Helper class that converted
to and from each database type system and the CLR type system using horrid
select/case consturcts.

I also would like to know if there is a better way to do it.
 
Back
Top