我有一个简单的电话:
public IActionResult GetApplications()
{
var result = context.Applications.Include(a=> a.AplicantCompany)
.Include(c=>c.CreditorCompany)
.ToList();
return Ok(result);
}
返回:
{"result":[{"context":null,"applicationId":1003,"aplicantCompany":{"id":1,"creditCompid":12344,"name":"Kibon","industry":"ice cream","address":"RaiboW street","city":"Rio de Janeiro","province":"Rio de Janeiro","country":"Brazil","postalCode":"9034-394","style":"modern","yearsStablished":100,"numEmployees":600,"salesAnnual":"12343434","taxId":323,"functionOfScore":12,"dateCreated":"2018-08-09T14:14:38.3325627"},"applicantCompanyID":1,"creditRequested":33333,"creditTerm":1,"processStatus":1,"recommendation":1,"approved":true,"creditApproved":1200000,"dateCreated":"2018-08-09T14:18:32.900369","dateProcessed":"2018-12-12T00:00:00","creditorCompanyId":1,"creditorCompany":{"creditorCompanyId":1,"name":"IBM","address":"boulevard of dreams","city":"Toronto","province":"ON","country":"Canada","postalCode":"M1t 2t5","revenue":12343,"riskPreference":23,"creditLimit":123,"portofolioScore":5.5,"userName":"Ronald","password":"1234","dateCreated":"2018-08-09T12:09:18.0977008","applications":[
出于某种原因,实体在获取其余数据之前就中断了。
当我尝试使用属性时:
[HttpGet("/api/applications")]
public IActionResult GetApplications()
{
var result = context.Applications.Include(a=> a.AplicantCompany.Name)
.Include(c=>c.CreditorCompany.Name)
.ToListAsync();
return Ok(result);
}
我什么都没有收到。有谁知道发生了什么?
注意:我现在收到此错误:
System.InvalidOperationException: '属性 'Name' 不是实体类型 'ApplicantCompany' 的导航属性。'Include(string)' 方法只能与 '.' 一起使用。导航属性名称的分隔列表。
但是属性存在...
狐的传说
摇曳的蔷薇
小唯快跑啊
相关分类