I have a list of integer IDs lets say MyIdList = {3, 7, 4, 1, 9, 2} which is subset of IDs present in my table. This list is sorted according to my conditions. I have DbContext and Dbset variables to query my postgres database table lets say MyTable. MyTable has lot of columns and rows.
When I issue the below query, i get the correct results(6 rows) but are sorted in some order which is not same as above order list.
My query is
List<MyTable> myresult = await dbset.Where(p => MyIdList.Contains(p.Id)).ToListAsync();
My requirement is to get myresult list of objects from this table using a linq query in the same order MyIdList exists.
Note: Only data that tells me the order is in the list and not present in this table or any table.