除了现有逻辑之外,我想允许g.CustomerBillId
撤回空值。
var previous = from g in FindAllCustomerPayments(obj.CustomerId)
join a in custPay
on g.CustomerBillId equals a.CustomerBillId
where System.Data.Entity.DbFunctions.TruncateTime(g.TransactionDateTime) <= previousBill.EffectiveDate
group g by new
{
CustomerId = g.CustomerId
} into p
select new
{
p.Key,
previousBalance = p.Sum(n => n.Credit) - p.Sum(n => n.Debit)
};
答案 0 :(得分:0)
你可以
from a in custPay.where(cust => cust.CustomerBillId = g.CustomerBillId).DefaultIfEmpty()