MrKevorkian
asked on
c# linq Join (i think)
HI,
i am using c# 3.5 and am trying to add to an existing linq query. But am stuck on how to query a repeating property on a class.
Here are the details:
I working with the following entity structure
public class Office
{
private int Id{get;set;}
private List<StaffForYear> StaffForYears {get;set}
}
public class StaffForYear
{
public int Id{get;set;}
public int Year{get;set;}
public StaffType StaffType{get;set;}
public int StaffCount{get;set;}
}
i am trying to write a linq query which says in psuedo code:
select * offices where Office.StaffForYear.StaffC ount was <= startOfMyRange And
Office.StaffForYear.StaffC ount was <= endOfMyRange
Finally i want to do this using a "Where" clause on an existing IQueryable<Office> query.
As i am building up a dynamic query.
So something like
public IQueryable<Office> CreateStaffCountQuery(int startOfMyRange, int endOfMyRange, IQueryable<Office> query)
{
return query.Where(o => o.StaffForYears........... .);
}
Thankyou very much.
i am using c# 3.5 and am trying to add to an existing linq query. But am stuck on how to query a repeating property on a class.
Here are the details:
I working with the following entity structure
public class Office
{
private int Id{get;set;}
private List<StaffForYear> StaffForYears {get;set}
}
public class StaffForYear
{
public int Id{get;set;}
public int Year{get;set;}
public StaffType StaffType{get;set;}
public int StaffCount{get;set;}
}
i am trying to write a linq query which says in psuedo code:
select * offices where Office.StaffForYear.StaffC
Office.StaffForYear.StaffC
Finally i want to do this using a "Where" clause on an existing IQueryable<Office> query.
As i am building up a dynamic query.
So something like
public IQueryable<Office> CreateStaffCountQuery(int startOfMyRange, int endOfMyRange, IQueryable<Office> query)
{
return query.Where(o => o.StaffForYears...........
}
Thankyou very much.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great! thanks alot!
Open in new window