我無法在db.Restaurants
對象上使用Include("CITies")
擴展方法。實體框架LINQ查詢2表
當我使用了包括我得到以下錯誤: DL.RESTAURANT does nto contain a definition for include or an extension method of include
namespace DL
{
public class DLgetRestaurants
{
DL.FVRGDataContext db = new FVRGDataContext();
public IEnumerable <RESTAURANT> getRestaurants(string cuisineName)
{
var restaurantList =
from RESTAURANT in db.RESTAURANTs.Include("CITies")
where RESTAURANT.CITies.Any(t => t.CITY_ID == 2)
orderby RESTAURANT.REST_NAME ascending
select RESTAURANT;
return restaurantList;
}
}
}
你得到了什麼錯誤? – Aducci
@Aducci,這是我不小心編輯出來的。它回來了 – msarchet
'db.RESTAURANTS'的數據類型是什麼? –