0
의 query.ToList()
내가엔티티 프레임 워크의 쿼리 개체가 개체의 인스턴스로 설정되지
객체 참조가 객체
x.Gallons
를 들어
의 인스턴스로 설정되지 얻을 수있는 모든 명령을 호출 할 때 이 값을 설정하면 null이 아닙니다. 또한 적절한 ID로 데이터베이스 테이블에 2 개의 DProduct가 있습니다. 무엇이 잘못 될 수 있습니까?
ProductSummaryCollection.Clear();
var query = from p in Repository.repository.ctx.DProduct
join fo in Repository.repository.ctx.DFuelOrder.Include("DProduct")
on p.ID equals fo.DProductID
group fo by fo.DProduct into Prod
select new DProductSummary
{
Product = fo.DProduct,
TotalGallons = (float)Prod.Sum(x => x.Gallons)
};
try
{
IList<DProductSummary> ps = query.ToList();
foreach (DProductSummary dps in ps)
ProductSummaryCollection.Add(dps);
}
catch (Exception exc)
{
}