I have two tables in lightswitch LOANS(Id(default),..) and RELEASES(Id(default),Loan,..).i want to create a screen with all pending loans to be shown in a datagrid.so i created a wcf RIA class library.i wanto return all the loans that have no releases yet.what would be the linq query for that. i tried this from other SO post but it gave a null reference exception.Nullreference exception was unhandled by user code.Object reference not set to an instance of object
Loan to Release has 1 : 0/1 (one loan to zero or one release)relationship a loan can have zero or one relationship.a release must have a loan.
[Query(IsDefault = true)]
public IQueryable<PendingLoans> GetPendingLoans()
{
var res = from l in this.context.Loans
join r in this.context.Releases
on l equals r.Loan
where r.Loan == null
select new PendingLoans { BillNo = l.BillNo };
return res.AsQueryable<PendingLoans>();
}