I am working on converting a web forms project to an ASP.NET MVC 4 project.
In this project we the .NET team are not allowed to modify the existing stored procedures, at max we are allowed to write a wrapper for this stored procedure. I.e. We can create an another stored procedure which calls the existing ones.
The existing stored procedure is of the following type
condition 1
Select A,B,C,D from Table
condition 2
Select ErrorCode as 100, ErrorMessage as 'Correct that'
condition 3
Select ErrorCode as 101, ErrorMessage as 'Correct this'
condition 4
Select ErrorCode as 102, ErrorMessage as 'Not found' from Table
And I am using Entity Framework in this project which requires a complex type to be pre-mapped so for the above type of stored procedure I have declared a complex type as
Complex Type :- SomeComplexType
string A;
string B;
string C;
string D;
int ErrorCode;
string ErrorMessage;
Now my problem is lack of SQL knowledge and syntax, I have been searching a lot on the google and SO, but was not able to find anything on this.
I want to know how to create a wrapper around this existing stored procedure, some thing like the one below.
condition 1
Select A,B,C,D,ErrorCode as NULL, ErrorMessage as NULL from Table
condition 2
Select A,B,C,D,ErrorCode as 100, ErrorMessage as 'Correct that' from Table
condition 3
Select A,B,C,D,ErrorCode as 101, ErrorMessage as 'Correct this' from Table
condition 4
Select A as NULL, B as NULL, C as NULL, D as NULL,ErrorCode as 102, ErrorMessage as 'Not found' from Table
So if I am able to send data from SQL like shown above I can then handle it easily using Entity Framework's function import and complex type.
How do I check (in the wrapper stored procedure) what result set is returned (from the existing stored procedure)?
Please guide me with ideas on this. Thanks