I tried the following expression
var listag = db.grupo.Include(x => x.Itens).ToList();
It does not work that way, but if I pass it this way:
db.grupo.Include("Itens").ToList();
, so it works, why? What am I doing wrong?
I tried the following expression
var listag = db.grupo.Include(x => x.Itens).ToList();
It does not work that way, but if I pass it this way:
db.grupo.Include("Itens").ToList();
, so it works, why? What am I doing wrong?
The implementation of Include()
using a delegate type is in namespace System.Data.Entity
for Entity Framework, or System.Linq
, if you were using Linq
, which is not your case.
As pointed out by @TiagoSilva in comment, check the Controller
header if it has the following statements:
using System.Data;
using System.Data.Entity;