返回數據的名單我有一個包含訂閱視圖模型在LINQ
public class ProjectViewModel
{
public String ProjectId { get; set; }
public String Name { get; set; }
public List<Subscriptions> Subscriptions { get; set; }
}
public class Subscriptions
{
public long Id { get; set; }
[MaxLength(40)]
public string ProjectId { get; set; }
public string SubscriptionId { get; set; }
}
現在我想收集視圖模型數據的正常性和列表的組合視圖模型。我將從數據庫上下文收集哪些內容,但是如何收集訂閱列表的數據?
var result = (from p in DataContext.Project join c in DataContext.Subscriptions
on p.ProjectId equals c.ProjectId
select new ProjectViewModel { ProjectId = p.ProjectId,
Name = p.Name
// List of subscriptions ?
'group'你''由C' ProjectId'。 –