Anybody do this?

Anybody do this?

Old forum URL:

webjedi posted on Friday, November 16, 2007

I am a horrible I am considering building a class that contains a list of constants that represent my stored procedures parameter names.

Does anyone else do this and aside from the initial setup is there any big drawbacks?

My stored procedure parameter names (90% anyway...the CRUD generated ones) match the column name.  So I am thinking about making a constant for each of my column names and then the writing an extension method to preface each one with the @ so I can make them a parameter...

Is that overkill and am I crazy?

JoeFallon1 replied on Friday, November 16, 2007


You are not crazy.

I did something like this for some table driven values. (Like Permissions.) e.g. I have a table of permissions and as new records get added then I periodically run my code gen template against the data to re-gen my constants for permissions. Then they show up in Intellisense and I get compile errors if I change something I shouldn't have.

I also do it for Session state handling so I can get strong typing and intellisense.

I don't see why you can't do something similar for your SPs.

If you add them to a metadata table (in some DB - not necessarily the one you ship) and then run your code generator against the data you will find it makes things easier in the long run. Also more consistent.



Copyright (c) Marimer LLC