我无法在Include("CITies")
对象上使用db.Restaurants
扩展方法。
当我使用include时出现以下错误:
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;
}
}
}
答案 0 :(得分:0)
您只能使用包含在与另一个表有关系的实体上。除此之外,你不应该有问题。