我有Entity Framework实体具有RSVP EntityCollection的事件。我想将RSVP的EntityCollection转换为POCO类RSVP的通用列表<>。如何将EntityCollection <T>转换为列表<POCOObj>
所以我想要EntityCollection - >列表。
要实现这一目标,最好的方法是什么?
到目前为止,我有这个(它缺少RSVP部分)
var events = from e in _entities.Event.Include("RSVP")
select new BizObjects.Event
{
EventId = e.EventId,
Name = e.Name,
Location = e.Location,
Organizer = e.Organizer,
StartDate = e.StartDate,
EndDate = e.EndDate,
Description = e.Description,
CreatedBy = e.CreatedBy,
CreatedOn = e.CreatedOn,
ModifiedBy = e.ModifiedBy,
ModifiedOn = e.ModifiedOn,
RSVPs = ???
};
感谢。
结帐这个[预测,包括(http://www.thejoyofcode.com/Projection_blows_includes_in_Entity_Framework。 aspx)博文。 – kervin 2010-03-13 08:52:16