S
Steven Blair
Hi,
I am currently writing a method for calling stored procedures. I want the
method to be able to handle variable amount of parameters and need some
advice on the design of this.
The way I see it, there is two ways of doing this.
Number 1 being a method for each stored procedure.
Each of these procedures would call the appropiate SP and also build up the
SqlParameters in there.
This could be a bit time consuming and difficult to maintain. My class would
be messy with various different methods just for calling SP.
The second way is to create a generic method which calls a SP by a parameter
name passed and also an array of SqlParameters. This means the client is
responsible for setting up an parameters required for the SP (name, data
type).
The SP method simply loops round the array adding all the SqlParameters.
Thats my thoughts on the matter.
Does anyone have any other ways of doing this, or opinions on what I have
just described ?
I am currently writing a method for calling stored procedures. I want the
method to be able to handle variable amount of parameters and need some
advice on the design of this.
The way I see it, there is two ways of doing this.
Number 1 being a method for each stored procedure.
Each of these procedures would call the appropiate SP and also build up the
SqlParameters in there.
This could be a bit time consuming and difficult to maintain. My class would
be messy with various different methods just for calling SP.
The second way is to create a generic method which calls a SP by a parameter
name passed and also an array of SqlParameters. This means the client is
responsible for setting up an parameters required for the SP (name, data
type).
The SP method simply loops round the array adding all the SqlParameters.
Thats my thoughts on the matter.
Does anyone have any other ways of doing this, or opinions on what I have
just described ?