I have a local list of Ids and I need to check existence of this Ids in DB.Table
.
I wrote following code:
List<int> localIdList;
//filling localIdList
var idArrayFromDb = DB.Table
.Select(s => s.ID)
.ToArray();
bool isSubset = !localIdList
.Except(idListFromDb)
.Any();
For now it works well, but I believe it's not the best way to solve this problem.
So I'm wondering, can I do the same without gathering a collection of Ids from DB or some any better way?