2016-04-10 8 views
-1

がなぜこの仕事を行います。Entity Frameworkの照会エラー

List<Item> items = ndb.Items.Where(m => m.ProductId == id).OrderByDescending(m => m.Id).ToList(); 
int itemid = items[0].Id; 
bool wlexists = ndb.Wishlists.Any(m => m.ItemId == itemid && m.UserEmail == User.Identity.Name); 

をそして、これがない:

List<Item> items = ndb.Items.Where(m => m.ProductId == id).OrderByDescending(m => m.Id).ToList(); 

bool wlexists = ndb.Wishlists.Any(m => m.ItemId == items[0].Id && m.UserEmail == User.Identity.Name); 
+0

2番目のクエリが機能しない理由はありませんが、例外は何ですか? –

答えて

0

itemsはすなわちヌルでない値を持っていた場合、それが動作する必要があります。あなたは何のエラーを表示していますか?

このようにします。

関連する問題