I have a view and entity
var q = from stud in context.CollegePlans
where stud .Meta.Active == true &&
stud .CreatedBy_Id == user.Id
select stud ;
var k = from nv in context.vw_Year_Plans
where ( nv.StudentId == q.Where( p => p.Section.StudentId))
select nv;
studenId is Guid in both view and in entity..when i do the above it says cannot implictly convert system.Guid ? to bool ..how to overcome this ?
The expression evaluated by
Whereneeds to evaluate to a boolean value.In this case, you have given it a
Guid. That is where the error is coming from. I think you would have problems with that line even if theWherepredicate was valid. From the looks of it, you want to want all of theStudentIds incontext.vw_Year_Plansthat are also inq.A simple way to do that is to create an intermediate collection of the ids in
qfor comparison purposes.Then see if each
StudentIdis also incontext.vw_Year_PlansThere are better ways to solve this issue, but this should get you going.
EDIT
You mentioned using
joinin your comment. I haven’t tested either of these solutions but this should be what you need. If you are still having problems, update your question with more specific details on the issues you are facing.