Reputation: 13
var a = from sc in context.SchoolClass
join bc in context.BookClass
on sc.ClassID equals bc.ClassID into temp
from tt in temp.DefaultIfEmpty()
where bc.ClassID == null && sc.SchoolYear == "2015"
select sc.ClassID;
Question: In the above code, " bc.ClassID == null " bc tip does not exist! I know "bc.ClassID == null" is wrong, but I don't know how to make this right!
Upvotes: 1
Views: 71
Reputation: 21825
Since you are doing a left join
here, you won't be able to access the properties of bc
, you can access the properties via tt
and it may contain null for non matching rows. Try this:-
var a = from sc in context.SchoolClass
join bc in context.BookClass
on sc.ClassID equals bc.ClassID into temp
from tt in temp.DefaultIfEmpty()
where tt.ClassID == null && sc.SchoolYear == "2015"
select sc.ClassID;
Upvotes: 1