Entity Framework Patterns: Select Multiple Entities


I just published another new article on code project:

http://www.codeproject.com/KB/linq/EFPatternsSelectMultiples.aspx

It’s still pending for reviews.

I thought I could start teasing out some Entity Framework patterns for non-trivial scenarios.

In this case, I’m trying to address the scenario where you want to select a given list of entities (you’re given the list of IDs of those entities).  I propose 4 approaches given their pros & cons and in which situation it makes sense to use them:

  • Selecting each entity one at the time
  • Doing a union via EF
  • Doing a where-in via EF
  • Joining on another table

As usual, I welcome feedback!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s