2
當執行使用LINQ到實體的「鍵/值表」下面的查詢,我得到一個[System.NotSupportedException] "Specified method not supported"
:錯誤的LINQ查詢透視
有人可以給我一個提示我做錯了嗎?
var Pivot = context.goe_postmeta.GroupBy(pm => pm.post_id).Select(
g => new PivotTemp
{
ID = g.Key,
FirstName = g.FirstOrDefault(p => p.meta_key == "_billing_first_name").meta_value,
LastName = g.FirstOrDefault(p => p.meta_key == "_billing_last_name").meta_value,
Address = g.FirstOrDefault(p => p.meta_key == "_billing_address_1").meta_value,
PostCode = g.FirstOrDefault(p => p.meta_key == "_billing_postcode").meta_value,
Phone = g.FirstOrDefault(p => p.meta_key == "_billing_phone").meta_value,
OrderTotal = g.FirstOrDefault(p => p.meta_key == "_order_total").meta_value,
PickupLocation = g.FirstOrDefault(p => p.meta_key == "_pickup_location").meta_value,
PickupTime = g.FirstOrDefault(p => p.meta_key == "_pickup_time").meta_value,
OrderItems = g.FirstOrDefault(p => p.meta_key == "_order_items").meta_value
}).ToList();
對不起,這是一個錯字...'。'到位了! – 2013-03-07 18:14:06