Click here to Skip to main content
15,667,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am finding difficulties in getting the dynamic resultset from a stored Procedure in Entity Framework 6.0.

The scenario is like this:
I have a stored procedure which gonna return resultset based on some condition.

ALTER procedure [dbo].[testProc] @val varchar(50)
as begin
if(@val='Dependant') begin
select ADM_Dependent.* from ADM_Dependent join MST_Employee
on ADM_Dependent.EmployeeId=MST_Employee.EmployeeId
else if (@val ='Employee')
select * from MST_Employee

But while adding the stored procedure to Entity Framework, I only get the result set having column of First Condition,
And When I am going to pass the parameter value as 'Employee', it throws exception and its obvious also,The result is of employee and I am binding to Dependant entity(which has been generated by storedProc).

Please let me know if,there is any solution to handle the dynamic result set in entity framework 6.0.

Thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900