krishna kishore

krishna kishore

  • NA
  • 5
  • 11.3k

how to return dynamic stored procedures in entity framework

Dec 12 2014 3:56 AM
Hi all,
 
i am using entity frame work  for model in the data Access layer. 
I have a Stored Procedure which executes some dynamic SQL. I want to use this Stored Procedure in entity framework 4, but when I try to create a complex type the procedure returns no columns. Is there any way I can force it to return my values and get the entity framework to receive them? Here is a much-simplified example of what I want to do:
 
 
CREATE PROCEDURE sp_calculatesalarybegin
(@EmployeeId as int)
declare dynsql as varachar(500)
 @dynsql='Select @Salary=Salary,@UserName=Username from employee where EmployeeId='+cast(@EmployeeId as varchar)+ ''
 exec(@dynsql)
end


Answers (4)