I am using Entity Framework 5.
Below is my SQL Query which runs successfully:
Select person.pk
from person, job
Where
person.jobId= job.pk
and
job.Description = 'CEO'
I have changed the table and column names in the above query.
Now whenI am converting the above query to below LINQ:
from person in Context.Person
from job in Context.Job
where
person.jobId== job.PK &&
job.Description == "CEO"
select new {
person.PK
};
But the above LINQ is giving me an exception:
Unable to create a constant value of type 'Models.Job'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
The LINQ looks simple enough but I am not able to figure out as to what am I missing.
This might be duplicate, but all the questions similar to this one were different and none of them addressed this issue.
Any help would be appreciated.