Making flexible C# code in MVC2 for Stored Procedures
Posted
by cc0
on Stack Overflow
See other posts from Stack Overflow
or by cc0
Published on 2010-05-23T18:42:24Z
Indexed on
2010/05/23
18:51 UTC
Read the original article
Hit count: 905
Thanks to Darin Dimitrov's suggestion I got a big step further in understanding good MVC code, but I'm having some problems making it flexible.
I implemented Darin's suggested solution, and it works perfectly for single controllers. However I'm having some trouble implementing it with some flexibility. What I'm looking for is this;
- To be able to make dynamic column names in json
Instead of using "Column1: 'value', ..." and "Column2: 'value', ..." inside the json, I'd like to use for example "id: 'value', ..." and "place: 'value' ..." for one stored procedure, and "animal" and "type" in another (inside the json format).
- To be able to make dynamic amounts of columns dependent on which stored procedure is called
Some stored procedures I'll want to read more than 2 rows from, is there a smart way of accomplishing that?
- To be able to make numeric (floats and integers) rows from the database be presented inside the json without quotes
Like this (name and age);
{
Column1: "John",
Column2: 53
},
I would be very grateful for any feedback and suggestions / code examples I can get here. Even imperfect ones.
© Stack Overflow or respective owner