Given an entity that looks like this:
public ICollection<UserActivity> Activities { get; set; }
public ICollection<UserTraining> Training { get; set; }
And wanting to filter Users based on an array of IDs, i.e. calling the following method:
public User[] GetUsers(int[] activityIds, int[] trainingIds)
What is the most efficient way of writing the above method implementation. If I was passing in a non-array integer it would be trivial, but I want to know the best way of writing it to avoid multiple database calls.
I'm using Linq to Entities.
The operation should return users who have any of the activity or training IDs, not all of them.