這裏是我的代碼,我希望有人能賜教:實體或複雜類型不能在LINQ to Entities查詢中構造?
public async Task<ActionResult> Search()
{
NameValueCollection filter = HttpUtility.ParseQueryString(Request.Params.ToString());
string term = filter["term"];
var query = db.ProductGraphicsCards
.Where(pgc => pgc.GraphicsCardSKU.StartsWith(term))
.Select(pgc => new ProductGraphicsCard()
{
GraphicsCardSKU = pgc.GraphicsCardSKU,
GraphicsCardMemory = pgc.GraphicsCardMemory
};
var products = await query.ToListAsync();
List<string> items = new List<string>();
foreach (var product in products)
{
items.Add(product.GraphicsCardSKU + "/" + product.GraphicsCardMemory.ToString());
}
return Json(items, JsonRequestBehavior.AllowGet);
}
給我的錯誤,我不明白爲什麼
請填寫完整的錯誤。 –