I know it was asked before, but I haven't managed to find up-to-date and complete answer for it.
So, what is the most efficient way to get a list of entities by their primary keys?
We have two separate cases, I guess:
- The primary key is simple i.e. over one column
For instance, I have
IEnumerable<int> ids
I want to get all entities whereId
of entity is inids
- The primary key is composite i.e. over multiple columns
Similar as above but
ids
is something likeIEnumerable<Tuple<int, int, int>>
, for instance