title: Code First Join options in Entity Framework 5
body: <p>I'm creating a webservice layer over a legacy SQL Server based system.  It's a pretty large and complicated business application which has a large number of stored procedures that perform SELECT statements .  Most of these stored procedures join a number of tables and produce a single resultset for easy consumption by the client.</p>
  
  <p>In building my webservice I want to take advantage of EF, and using a Code First approach 80% of my use cases can be achieved by mapping direclty to tables.  However I have a number of use cases where  I need the cross tbale views of data as provided by the stored procedures.  As I see it I have 3 options:</p>
  
  <ol>
  <li>Create new POCOs that represent the stored procedure returns and link these to the existing stored procedures (let SQL do the join and re-use exisitng code)</li>
  <li>Create new POCOs that look like the stored procedure return, but populate themselves by association with othe EF entities (let EF do the jons)</li>
  <li>Do the joins somehow in LINQ</li>
  </ol>
  
  <p>What do people think is best practice in situations like this, which I guess most of us are coming up against everyday?</p>
  
  <p>Thanks,
  Andy</p>