Entity framework and stored procedure with output parameter returning row (EF will receive complex type)

complextype entity-framework-6 output-parameter row stored-procedures

Question

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.

1
0
6/26/2014 9:44:42 AM

Popular Answer

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

0
1/29/2015 6:24:47 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow