My lambda expressions within the Include statements are getting the error in that I’ve included in the title of this post. I do have a ‘using.System.Linq’ in my class. What’s up? ~susan~
FVTCEntities db = new FVTCEntities();
public List<RESTAURANT> getRestaurants(string cuisineName)
{
var cuisineID = db.CUISINEs.First(s => s.CUISINE_NAME == cuisineName).CUISINE_ID;
List<RESTAURANT> result = (from RESTAURANT in db.RESTAURANTs.Include(x => x.CITY).Include(x => x.CUISINE)
where RESTAURANT.CUISINE_ID == cuisineID
select RESTAURANT).ToList();
return result;
}
In EF, the Include() method accepts a string as parameter. If you want it to accept Lambda Expressions, you should read the following post: http://tomlev2.wordpress.com/2010/10/03/entity-framework-using-include-with-lambda-expressions/