I've just learned how to include multpiple level properties with Entity Framework ( on this thread : Entity Framework - Include Multiple Levels of Properties). But things fail when I'm attempting to include a collection containing the base entity.
Here is my base class :
public partial class Artiste
{
public Artiste()
{
this.Parutions = new HashSet<Parution>();
}
public System.Guid Id { get; set; }
public string Nom { get; set; }
public virtual ICollection<Parution> Parutions { get; set; }
}
And my second class :
public partial class Parution
{
public Parution()
{
this.Artistes = new HashSet<Artiste>();
}
public System.Guid Id { get; set; }
public string Title { get; set; }
public virtual ICollection<Artiste> Artistes { get; set; }
}
Artiste have many Parutions. Parution have many Artistes. When I'm querying an Artiste while including his Parutions :
dbQuery.Include(a => a.Parutions);
In the Parutions Artistes, I've got only the queried Artiste (one Artiste). I don't get the other Artistes. I've tried this :
dbQuery.Include(a => a.Parutions.Select(p => p.Artistes));
But it gives some error that Artiste is already loaded.
How to achieve this ?