class loan
{
public money Value{set; get;}
public int id{set; get;}
public int CustomerId{set; get;}
}
class loanPayment
{
public int id{set; get;}
public int LoanId{set; get;}
public money Value{set; get;}
}
我尝试了这个 LINQ 代码:
//_CustomerId is a parameter
DatabaseContext context = new DatabaseContext();
var query =
(from l in context.Loan
where l.CustomerId == _CustomerId
join lp in context.LoanPayment on l.Id equals lp.LoanId into j1
from Payments in j1
select Payments
).ToList();
现在我的问题是,此代码将仅返回loan至少有一项的记录payment,但我希望记录与其付款相关联,并且我还想要尚未付款的贷款,我该如何执行此操作?
像这样的东西:
第一笔贷款有付款,但第二笔没有。
白衣非少年
开满天机
相关分类