我目前有跟随LINQ代码工作,每个引号返回一行。我需要修改它以返回一个额外的表,每个引号可能有很多记录,我不知道如何添加这些代码,因为我还在学习。
var query = DbContext.QuoteInformation
.Include("Customer")
.Include("Priority")
.Include("Status")
.OrderBy(q => q.RFQ);
totalRecords = query.Count();
return query.ToList();
我需要在此查询中包含的表格包含以下列 -
public class QuoteTransaction
{
[Key]
public Guid Id { get; set; }
public Guid QuoteInformationId { get; set; }
public Guid DepartmentId { get; set; }
public Guid StatusId { get; set; }
public bool Checked { get; set; }
public string Comments { get; set; }
public string UserId { get; set; }
public QuoteInformation QuoteInformation { get; set; }
public Department Department { get; set; }
public Status Status { get; set; }
public ApplicationUser User { get; set; }
public QuoteTransaction()
{
Id = SequentialGuid.Create(SequentialGuidType.SequentialAtEnd);
}
}
答案 0 :(得分:1)
您需要添加属性
.Include(r=>r.QuoteTransactions)
进入类QuoteSformation以获取tansactions列表
然后使用.Include更改你的LINQ(" QuoteTransactions")
如果返回导航属性异常
,还可以在LINQ中添加以下代码UPDATE summoners_shell
SET summonerId=".$s.",
timestamp=".$time."
WHERE timestamp=(
SELECT MIN(timestamp)
FROM
summoners_shell
)