我有以下模型(简化)
public partial class Fault
{
public int FaultID { get; set; }
...
public virtual ICollection<FaultComment> FaultComments { get; set; }
public virtual User FaultCreatorUser { get; set; }
}
public partial class FaultComment
{
public int CommentID { get; set; }
public int FaultID { get; set; }
public string CommentContent { get; set; }
public Nullable<System.DateTime> CommentCreationDate { get; set; }
public int CommentCreatorUserID { get; set; }
public bool IsDeleted { get; set; }
public virtual User User { get; set; }
public virtual Fault Fault { get; set; }
}
所以有一个错误..它有一个导航属性来获取错误的评论集合,每个推荐都有一个导航属性,供创建评论的用户使用。
是否可以创建一个 LINQ 语句来检索故障的所有评论和评论的用户信息?
就像是
var faultsWithComments = _context.Fault.Include("FaultComments").include("???FaultComments>>User???")