我有几个相关的表格(实体)。 I m试图利用下列支线使各实体受益:
ObjectQuery<Location> locations = context.Location;
ObjectQuery<ProductPrice> productPrice = context.ProductPrice;
ObjectQuery<Product> products = context.Product;
IQueryable<ProductPrice> res1 = from pp in productPrice
join loc in locations
on pp.Location equals loc
join prod in products
on pp.Product equals prod
where prod.Title.ToLower().IndexOf(Word.ToLower()) > -1
select pp;
查询记录2 产品目标与产品挂钩,但无效,我无法理解原因。 如果我试图在小组中填满如下:
res =
from pp in productPrice
join loc in locations
on pp.Location equals loc
join prod in products
on pp.Product equals prod
where prod.Title.ToLower().IndexOf(Word.ToLower()) > -1
select new ProductPrice
{
ProductPriceId = pp.ProductPriceId,
Product = prod
};
I have the exception "The entity or complex type PBExplorerData.ProductPrice cannot be constructed in a LINQ to Entities query" Could someone please explain me what happens and what I need to do? Thanks