I have an example of a query like the following. I have two tables named product and category. But I want him to do the search by name, not by id.I did the join but I get the error like below.The part where I get the error "from p in context.Products"
.The error I received is Could not find an implementation of the query pattern for source type. 'Join' not found.
public List<Product> GetProductsByCategory(int categoryId)
{
using (var context= new NorthwindContext())
{
var query= from p in context.Products
join c in context.Categories on p.CategoryId equals c.CategoryId
select new
{
ProductName= p.ProductName,
QuantityPerUnits = p.QuantityPerUnit,
UnitPrice = p.UnitPrice,
UnitInStock = p.UnitsInStock,
Category = c.CategoryName
};
return query.ToList();
}
}
What is the reason for this error? How can I fix.