【发布时间】:2010-03-13 07:44:43
【问题描述】:
我有实体框架实体事件,它们具有 RSVP 的 EntityCollection。我想将 RSVP 的 EntityCollection 转换为 POCO 类 RSVP 的通用 List。
所以我想要 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 = ???
};
谢谢。
【问题讨论】:
-
查看这篇 Projections and Includes 博文。
标签: c# asp.net asp.net-mvc entity-framework