iqueryable select/where not working

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-06-17T20:56:50Z Indexed on 2010/06/17 21:03 UTC
Read the original article Hit count: 146

Filed under:
|
|
|

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 IsProspect Debug Example

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ