Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

StackOverflowException when including a navigation property

$
0
0

I have a collection of ProjectMissingPeople as a navigation property on Project. When I try to include them when passing a list of Project to a view, I get a stack overflow exception. Do you know how to fix it?

Code that is generating error:

public ActionResult Index()
{
   return View(db.Projects.Include(p => p.ProjectMissingPeople).ToList());
}

Project class:

publicclassProject{publicintProjectID{ get;set;}...publicvirtualICollection<ProjectMissingPeople>ProjectMissingPeople{ get;set;}}

ProjectMissingPeople class:

publicclassProjectMissingPeople{publicintProjectMissingPeopleID{ get;set;}publicstringText{ get;set;}publicboolOpen{ get;set;}publicintProjectID{ get;set;}publicvirtualProjectProject{ get;set;}}

Viewing all articles
Browse latest Browse all 1698

Trending Articles