Entity Framework Patterns: Select Multiple Entities
Solution ·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!