I use Lucene.net to create MyListOfIds As List(Of Integer), which I then pass to my Linq service. Then I scan the database as follows:
Return _EventRepository.Read().Where(Function(e) MyListOfIds.Contains(e.ID)).ToList
Now I know that Lucene already orders MyListOfIdsdepending on the weight he gave to each member. What sucks is that Linq loses this order in it SQL search.
My question is: How do I maintain this sort order when building a Lambda expression?
I tried using LINQPad to see how the query is built, but since I had to declare a variable LINQPad did not show me the resulting SQL :-(
Here is what I tried in LINQPad
Dim i As New List(Of Integer)
i.Add(1)
i.Add(100)
i.Add(15)
i.Add(3)
i.Add(123)
Dim r = (From e In Events
Where i.Contains(e.ID)
Select e)
note: VB.NET, , #