I am using entity framework 6 with stored procedures. Currently I deal with this problem:
Ideally I need to get data from one stored procedure. This data includes: One Conversation (basic info) + multiple Clients (which are engaged in this conversation) + Messages from Conversation.
I think that output parameters is right way to do, but i am stuck.
So, how can I do that? And is this the right way to get rows of different data from stored procedure? I am trying to avoid a solution where I would be sending recurring data about conversation with every row of the client.
You can try with
static void Main(string[] args)
{
using (SchoolEntities context = new SchoolEntities())
{
var outputParameter = new ObjectParameter(“sumâ€, typeof(decimal));
context.SchoolBudgetForDateRange(new DateTime(2007, 1, 1),
new DateTime(2008, 1, 1),
outputParameter);
Console.WriteLine(outputParameter.Value);
}
}
where SchoolBudgetForDateRange is a stored procedure
more info here