我在LINQ to SQL中有一个工作查询。我需要将它转换为LINQ to Entities。LINQ to Entities中的子查询
(from pr in Products
join c in Categories on pr.CategoryID equals c.CategoryID
join b in Colors on pr.ColorID equals b.ColorID
select new{
ProductID = pr.ProductID,
Manufacturer = pr.Manufacturer.Name,
Model = v.Model.ModelName,
Category = c.Name,
Photos = from p in Photos where pr.ProductID == p.ProductID select p
}).FirstOrDefault()
当我使用它,因为它是我得到一个错误:
Unable to create a constant value of type Only primitive types ('such as Int32, String, and Guid') are supported in this context.
的问题是在这个部分:
Photos = from p in Photos where pr.ProductID == p.ProductID select p