views:

62

answers:

2

Here's my query.

var query = from g in dc.Group
            join gm in dc.GroupMembers on g.ID equals gm.GroupID
            where gm.UserID == UserID
            select new {
                id = g.ID,
                name = g.Name,
                pools = (from pool in g.Pool
                // more stuff to populate pools

So I have to perform some filtering, but when I attempt to filter

var filter = query.Where(f => f.pools.[no access to list of columns]  

I can't access any of the items within "pools". Does anyone know how I'm able to access that?

What I'd like to do is this:

var filterbyGame = query.Where(f = > f.pools.GameName == "TestGame");

Let me know if that's even possible with thew ay I have this setup.

Thanks guys.

+4  A: 

In your query you can't do Where(f => f.pools.GameName) because f is an IEnumerable<>

Something like this should work:

Where(f => f.pools.Any(p => p.GameName == "TestGame"))
minimalis
+2  A: 

pools is an enumeration, not a single instance. That's why you're not getting column names.

You need to change your filter to something like:

var filterByGame = query.Where(f => f.pools.Any(p => p.GameName == "TestGame"));
Justin Niessner
so I tried this;var test = query.Where(f => f.pools.Any(p => p.GameName == "Test")); doesn't work.
Jack Marchetti
@Jack Marchetti - Are you sure that f.pools contained a GameName match? Always double check and make sure.
Justin Niessner
Yep I'm positive. I did a copy and past eon the == "GameName" I even tried doing a .ToLower() just in case.
Jack Marchetti