var query =
(
from i in service.GetInvoices()
from s in service.GetStatuses()
where i.ProjectID == projectid &&
s.ID == i.invStatus //"join" condition here
//add here any more where clausole you need
select i //you still need invoices returned?
).Skip(pageIndex * pageSize).Take(pageSize);
Using join:
var query =
(
from i in service.GetInvoices()
join s in service.GetStatuses() on s.ID equals i.invStatus
where i.ProjectID == projectid
//add here any more where clausole you need
select i //you still need invoices returned?
).Skip(pageIndex * pageSize).Take(pageSize);
If I understood your db structure correctly I would go for:
var query =
(
from i in service.GetInvoices()
from s in i.Status //get all the statuses associated to this invoice
where i.ProjectID == projectid
//add here any more where clausole you need
select i //you still need invoices returned?
).Skip(pageIndex * pageSize).Take(pageSize);