We're using Stored Procedures for every query to the DB. This seems incredibly un-DRY:
- Design the table
- Design CRUD operation SPs for that table
- Design code (preferably a class) to fill parameters and execute CRUD SPs
If we add a single column, or change a datatype, we have to edit the table, a handful of SPs, and a handful of functions in a class within .NET.
What are some tips for reducing this duplication?
UPDATE:
In combination with Vinko's idea, I found this. Here's a bit of code (in C#) that I came up with for those that need it:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MySQLConnString"].ConnectionString);
SqlCommand comm = new SqlCommand("NameOfStoredProcedure", conn);
comm.CommandType = CommandType.StoredProcedure;
conn.Open();
SqlCommandBuilder.DeriveParameters(comm);
conn.Close();
foreach (SqlParameter param in comm.Parameters)
{ /* do stuff */ }