score:3

Accepted answer

You need to execute first and return an IEnumerable then with linq to Objects create a list

var events = (from c in context.Events.Include("EventPeople")
                    select new
                    {
                        ID = c.ID,
                        Title = c.Title,
                        Description = c.Description,
                        Date = c.Date,
                        People = (from ep in c.EventPeople
                                 select new Domain.Entities.Person()
                                 {
                                     ID = ep.ID,
                                     Name = ep.Name
                                 })
                    }).ToList();
return events.Select(e => new  Domain.Entities.Event()
                    {
                        ID = e.ID,
                        Title = e.Title,
                        Description = e.Description,
                        Date = e.Date,
                        People = e.People.ToList()
                    }).ToList();

Related Articles