title: Entity Framework code-first & stored procedure
body: <p>I am using a code-first approach in my application. I have generated the entities (tables) using the approach. Now I would like to create a stored procedure as well through code. Can someone guide me as I tried migration option and it's failing.</p>
  
  <p>I am using Entity Framework Code First approach.Using this,I have created Customer and some other entities.</p>
  
  <p>Now I want to create a stored procedure 'GetCustomers' using context class and pass parameters and get result set in a collection</p>
  
  <p>it has to return 2 collections as below</p>
  
  <p>create procedure getcustomer @name nvarchar(max),@zipcode int</p>
  
  <p>as</p>
  
  <p>select  id,name,zipcode from Customer where name like (@name );</p>
  
  <p>select  id,name,zipcode from Customer where zipcode =@zipcode </p>
  
  <p>I want to create a stored procedure 'GetCustomers' using context class and not manually execute in DB.I need to achieve below results:</p>
  
  <p>1.Pass name parameter alone and return first collection</p>
  
  <p>2.Pass zipcode parameter alone and return 2nd collection.</p>
  
  <p>3.Combine result collection of 1 and 2 into a single collection using merge </p>