1
我得到一个奇怪的行为。我有一个我创建的类,用于将从数据实体编制的数据格式化为数据网格。我使用linq查询来从实体类型的列表中创建类类型的列表。一些类的属性可以从linq查询中访问,但其他的给我一个错误。 (AMNotStartedPortalDisplay'不包含'ChecklistStatusID'的定义)。所以我的问题是为什么linq可以访问一些属性而不是其他属性?我看不出为什么会发生这种情况。使用Linq来填充类
这里是我的类:
public class AMWOTPortalDisplay
{
public string DisplayName { get; set; }
public string LOB { get; set; }
public string DisplayProjectPackages { get; set; }
public string ChecklistStatus { get; set; }
public int ChecklistStatusID { get; set; }
public string InstallDate { get; set; }
public string dateToYellow { get; set; }
public string dateToRed { get; set; }
public string ApplicationManager { get; set; }
public string ApplicationManagerLanID { get; set; }
public int ApplicationManagerUserID { get; set; }
public string ImpersonatedManager { get; set; }
public string ImpersonatedManagerLanID { get; set; }
public int ImpersonatedManagerUserID { get; set; }
public string DelegateName { get; set; }
public string DelegateLanID { get; set; }
public int DelegateUserID { get; set; }
public string WOTAssignee { get; set; }
public int ChecklistID { get; set; }
public string DisplayLinkText { get; set; }
public string LinkTextURL { get; set; }
public string rowColor { get; set; }
public string rowTextColor { get; set; }
}
这里是LINQ查询,因为我有这么远:
var portaldisplay = checklists
.Select(c => new AMNotStartedPortalDisplay
{
DisplayName = string.Format("{0} ({1})", c.Application.Name, c.Application.ApplicationID),
LOB = c.Application.LOB,
ChecklistStatus = c.ChecklistStatusType.TypeName,
ChecklistStatusID = c.ChecklistStatusTypeID
});
感谢,
朗达
哦我的天哪!它必须是星期一。两个不同的人看着这个,并没有看到。谢谢。 – Rhonda 2012-03-26 18:48:35