I have a Linq to Entities query like this:
var results = from r in entities.MachineRevision where r.Machine.IdMachine == pIdMachine && r.Category == (int)pCategory select r;
I usually use the code below to check if any results are returned:
if (results.Count() > 0) { return new oMachineRevision(results.First().IdMachineRevision); }
However, I get a NotSupportedException in if .
Error message: Unable to create a constant value of type "Closing Type". In this context, only primitive types (such as Int32, String, and Guid) are supported.
Note that pCategory is an Enum type.
Nelson reis
source share