Solve error in c# "unable to create a constant type ''. only primitive types or enumeration types are supported in this context" 23 July 2015 05:56 Coding (0) This occurred when trying to do a linq query using objects e.g.:db.Myitems.Where(a => a.Purchase == mvp );to fix this i just changed the code to use the Ids rather than the objects like so...db.Myitems.Where(a => a.Purchase.Id == mvp.Id);