it's your's

The entity or complex type cannot be constructed in a LINQ to Entities query.

In Linq-to-Entities you can only project to an anonymous type or a regular class. You can't project to an existing entity type. You can, however, project onto an annonymous type or onto a DTO:

public class ProductDTO
    public string Name { get; set; }
    // Other field you may need from the Product entity

And your method will return a List of DTO's.

public List<ProductDTO> GetProducts(int categoryID)
    return (from p in db.Products
            where p.CategoryID == categoryID
            select new ProductDTO { Name = p.Name }).ToList();

Comments (2) -