I have an existing database with lots of complex stored procedure and I want to use those procedure through EF 4. I have done the following:
msdn suggests the following:
CREATE PROCEDURE dbo.GetDepartmentName @ID INT , @Name NVARCHAR(50) OUTPUT AS SELECT @Name = Name FROM Department WHERE DepartmentID = @ID
Solution
using (SchoolEntities context = new SchoolEntities()) { // name is an output parameter. ObjectParameter name = new ObjectParameter("Name", typeof(String)); context.GetDepartmentName(1, name); Console.WriteLine(name.Value); }