Possible Duplicate:
Entity Framework: There is already an open DataReader associated with this Command
I have these classes:
public class VwSelectBrochures
{
public List<SelectBrochure> SelectBrochures { get; set; }
}
public class SelectBrochure
{
public int BrochureId { get; set; }
public string UrlImage { get; set; }
public string Description { get; set; }
public string Cat1Description { get; set; }
public string Cat2Description { get; set; }
public string Cat3Description { get; set; }
public List<LangSelection> Languages { get; set; }
}
public class LangSelection
{
public int Id { get; set; }
public string Description { get; set; }
public bool Vink { get; set; }
}
and this line of code:
var dbmodel2 =
from x in
brochures.AsEnumerable().Select(
x => new SelectBrochure {BrochureId = x.Id, Description = x.Description, UrlImage = x.UrlImage,
Languages = new List<LangSelection>(from y in x.BrochureLanguages select new LangSelection(){Description = y.Language.Description, Id = y.Language.Id})})
select x;
Brochures and BrochureLanguages are my db-models.
I know I get the error, because I can't do the "from y in x.BrochureLanguages", but I don't see how I can fix this.
What I really want is to get all the brochures into the VwSelectBrochures class.