Expression does not work in Include in the Entity Framework

0

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?

    
asked by anonymous 18.08.2014 / 16:23

1 answer

2

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;
    
18.08.2014 / 18:23