DonXML has a cool article I just read on how to use Attributes to extend Enums to create strongly typed parameter objects for ADO.NET commands. You can read the whole article here:
The article is cool for two reasons:
- It makes it so that adding a parameter is a very simple one line of code (not 2-3 with a bunch of parameters to mess with)
- It allows common parameters that should be the same everywhere (like, customerID) to be defined in one place. This way, you know everyone is using the same definition for the parameter, and if you switch from an int to a guid for customerID, you only have one place you need to change in your code to account for the db schema change.
[Listening To: System of a Down – Temper]