I have the following Entity Framework function that it joining a table to a list. Each item in serviceSuburbList
contains two ints, ServiceId
and SuburbId
.
public List<SearchResults> GetSearchResultsList(List<ServiceSuburbPair> serviceSuburbList)
{
var srtList = new List<SearchResults>();
srtList = DataContext.Set<SearchResults>()
.AsEnumerable()
.Where(x => serviceSuburbList.Any(m => m.ServiceId == x.ServiceId &&
m.SuburbId == x.SuburbId))
.ToList();
return srtList;
}
Obviously that AsEnumerable
is killing my performance. I'm unsure of another way to do this. Basically, I have my SearchResults
table and I want to find records that match serviceSuburbList
.