Circular reference in Jquery

mrlukas77

New Member
In my application I want to use Ajax with jQuery to dynamically load data into aspx page, problem is that I am getting Circular reference error. For example:\[code\]Person\[/code\] class with attributes \[code\]Name\[/code\], \[code\]LastName\[/code\] and \[code\]List<Dogs> dogs\[/code\], so that each person can have many dogs and each dog can have a name.Now in when I ask the server side method for list of persons I can do it like this: \[code\][WebMethod]public static List<Persons> getPersons(){ IEnumerable<Persons> list = GetPersons().Select(x => new Person { Name = x.Name, LastName = x.LastName, }); return list.ToList();}\[/code\]This is working, but as soon as I add \[code\]Dogs = x.Dogs\[/code\], I am getting circular reference exception. Does any one know any workaround without removing relations in DB?
 
Back
Top