iqueryable select/where not working
- by Steve
I have two tables Boxer and Prospect. Boxers has general stuff like name and and dob etc and a BoxerId
While Prospect contains only one value (at the moment) which is a boxerId.
If a boxer is a prospect(up and coming boxer) there Id will be in the prospect table.
This works fine but now I want to select all boxers that are prospects
public static IQueryable<Boxer> IsProspect(this IQueryable<Boxer> query)
{
//this does not filter down to only prospects!!!
return query.Where(x => x.Prospect != null);
}
This is the function I call using:
var repository = GetRepository<Boxer>();
var boxers = repository.Query().IsProspect();
I would hope this would filter my collection of all boxers down to just boxers that are prospects!
Oddly it doesnt filter it but if i hover over my boxers object and look at each boxer during debugging I can see "IsProspect" true or false correctly