SIGN UP MEMBER LOGIN:    
ARTICLE

Revised Generic 'T, K' Database Component

Posted by art_scott Articles | ADO.NET in C# December 20, 2005
This is the code behind the Generic 'T, K' Database Component.
Reader Level:
Download Files:
 

Please see my previous article 'Generic 'T, K' Database Component' written on December 17, 2005. In that article, I discussed why, I built this component as a generic<T, K>.

What I did not discuss is how the component changed from a code/design point of view while not changing in my original intent.

  • I wanted to cut down on the lines of code.
  • I wanted to use generics and see where it would take in while writing a database component.
  • I wanted to see if using generics for something other then array/collection pushing/popping was even reasonable.

What I found was:

  • Generics will change the way we do things.
  • Generics will change the way we think about writing re-usable components.
  • Generics got me re-excited about development.
  • Power...generics opens the door to a new future.

Point of interest in the code and within the solution:

  • In the SqlCommand object, I use the SqlCommandBuilder.DeriveParameters because I hate embedding stored procedure variables in code. Embedding stored procedure variables, etc., in my book, tightly couples my layers too closely to my code. What does that mean...change a stored procedure, you have to change code.
  • I added the update for Typed DataSets because I could. 99% of the time, I use stored procedures so I use either one of the creates where I pass in the SQL statement/stored procedure.
  • The Interface is not completed here in this version.

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor