Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have been attempting to write a Generic Data Access class for a .NET 2.0 application I am working on, mainly to get familiar with 2.0 and such.

 

A problem I have ran into recently, wouldnt be a huge problem if msdn2 would have documentation but it doesnt.

 

Heres the question:

 

I am attempting to create a Generic Database Parameter using DbParameter, however it is implemented as abstract currently in Beta2. Which makes me wonder if they are not done implementing it, or I just cant figure out how to get it to work.

 

Some details, I have a DataProviderFactories class that will give me the proper Factory based on configuration settings for my Data Provider type. So if its System.Data.SqlClient or System.Data.OleDb...

 

Then I have a DataAccessFactories class, this is responsible for giving me the proper Factory based on the DataProvider type. Reason for doing this? I am supporting Xml as a DataSource and it has to have its own completely seperate DataAccess implementation since its so different from actual Database access code... Ok now that you have an idea of how it works, you may see what I am trying to do...

 

Completely Generic Data Access Handling...

 

Articles I have read "Writing Generic Data Access Code in ASP.NET 2.0 and ADO.NET 2.0", "Generic Coding with the ADO.NET 2.0 Base Classes and Factories" so please do not reference me these documents.

 

Thank you for any help you may be able to offer!!!

Posted

I figured this out, nevermind.

 

In case anyone else needs the answer, it was actually in front of my face, just use the Provider and call CreateParameter(), it will return the correct Parameter type based on the Provider. Sorta feel stupid for missing that...o well.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...