我有一个asp net core 2.1 web api针对ef core 2运行,指向localdb上的数据库。
以下是我的poco课程:
public class Organization
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Production> Productions { get; set; }
public IList<OrganizationPerson> OrganizationPeople { get; set; }
}
public class Production
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int OrganizationId { get; set; }
public Organization Organization { get; set; }
}
public class OrganizationPerson
{
public int OrganizationId { get; set; }
public int PersonId { get; set; }
public Organization Organization { get; set; }
public Person Person { get; set; }
}
我的背景:
public class AuditioneerContext : DbContext
{
public DbSet<Organization> Organizations { get; set; }
public DbSet<Production> Productions { get; set; }
public DbSet<OrganizationPerson> OrganizationPersons { get; set; }
}
这是来自我的网络API的方法:
[HttpGet]
public IEnumerable<Organization> Get()
{
var result =
context.Organizations
.Include(o=>o.Productions)
.ToList();
return result;
}
当我调用此方法时,不会抛出任何错误,并且我得到json结果的前146个字符,但不是其余的。
[{"id":1,"name":"Ridgefield Theater Barn","productions":[{"id":1,"name":"Godspell","description":"Godspell by Stephen Schwartz","organizationId":1
我不明白为什么只返回部分结果。
我的Startup中是否有一段代码缺少会导致此问题?
如果我在Get方法中放置断点,则结果变量包含正确的数据