title: Retrieve table data from stored procedure using entity framework
body: <p>I'm using Entity Framework v6. I have a stored procedure as shown below</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[GetCountryList] 
  (
      @CustomerName VARCHAR(MAX), 
      @SearchCriteria VARCHAR(MAX)
  )
  AS
      BEGIN
      SET NOCOUNT ON
  
          SELECT CountryID, CountryName FROM dbo.Table1 
          WHERE CustomerName = @CustomerName AND CountryName = @SearchCriteria
      END
  </code></pre>
  
  <p>Now I have a model class</p>
  
  <pre><code>public class CountryName
  {
      public int CountryId { get; set; }
      public string CountryName { get; set; }
  }
  </code></pre>
  
  <p>So I want to get the result of the <code>SELECT</code> query in a <code>List&lt;CountryName&gt;</code> type</p>
  
  <pre><code>List&lt;CountryName&gt; countryList = null;
  
  using (DbEntities dbContext = new DbEntities())
  {
      countryList = //my code to collect the result
  }
  </code></pre>
  
  <p>Well, I could have run a LINQ to SQL directly on the table but unfortunately my requirement in to get the data from stored procedure. So, how can I do it?</p>