Linq To SQL: Retain list order when using .Contains
- by rockinthesixstring
I'm using Lucene.net to build a MyListOfIds As List(Of Integer) which I then pass on to my Linq service. I then search the database as follows
Return _EventRepository.Read().Where(Function(e) MyListOfIds.Contains(e.ID)).ToList
Now I know that Lucene is already ordering MyListOfIds based on the weight it gave each term. What sucks is that Linq is…