title: Use stored procedure in Entity Framework (code first)
body: <p>I use this code to define my stored procedure</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[SP]
  (@Country NVARCHAR(20))
  AS
  BEGIN
      SET NOCOUNT ON;
      SELECT c.*,O.* from Customers
             as c inner join orders O on c.CustomerID=o.CustomerID
  
       where  c.Country=@Country 
  END
  </code></pre>
  
  <p>and this is my C# code:</p>
  
  <pre><code>IList&lt;Entities.Customer&gt; Customers;
  
  using (var context = new NorthwindContext())
  {
     SqlParameter categoryParam = new SqlParameter("@Country", "London");
     Customers = context.Database.SqlQuery&lt;Entities.Customer&gt;("SP @Country",  categoryParam).ToList();
  }
  </code></pre>
  
  <p>Problem is here :</p>
  
  <p>I want to message the data from <code>Orders</code> table and my stored procedure generate this to me. How can I get the <code>Orders</code> data in my C# code? Remember I want to execute this stored procedure only once.</p>