DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 637 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

16
kicks
published 1 year, 8 months ago, submitted by rcerff 1 year, 8 months ago

codeproject.com — There's a lot of repetitive work associated with the writing of data classes within the data access layer of an N-tiered architecture. Apart from adding a column to the relevant database table, adding a field to the class involves adding a private variable to hold the field value, a property to expose it to other classes, and several lines to make sure the field is included in insert, fetch, and update operations. If you're using stored procedures (very silly for CRUD queries) that several more modifications to make. This is dull work I'm sure you'll agree. Presented here is a lightweight method for taking away all this tedium, such that you only have to add a getter/setter property in order to add a field to a data class. The technique involves abstracting SQL query writing and execution, and variable storage in data access classes to a base class. In the implementation presented here I've named this base class "PersistentDataObject". The "less then 300 lines of code" referred to in the title of this post are the lines of code in this base class, the database access class it uses, and a couple of exception classes used as markers to add clarity to exception origins. The complete code is included at the end of the post.

Add a comment 2 comments | category: | Views: 2 | Get KickIt image code
tags: , , | tag it

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:
The code looks interesting, but a warning - the bases class makes extensive use of non-parameterized SQL leaving these classes wide open to SQL injection attacks.
posted by mikethomas 1 year, 8 months ago
Mike, read the comments to the article: the author claims there is no such security hole, because he's using parameters.
posted by JudahGabriel JudahGabriel 1 year, 8 months ago



information Login or create an account to comment on this story
 

Sponsored Link: www.carlist.ie

Search:

Ads by The Lounge