This is more of a share knowledge than anything else. Wasn’t sure if I was supposed to make it a question.
So I have multiple issues with the following error Object graph for type 'xxx' contains cycles
There are many ways the internet says to fix it, for instance adding the IsReference=true attribute, creating your own custom attributes, etc.
For me I find the most simplest way is by just making the child parent object have a private setter.
ie.
public ParentObject objectName { get; private set; }
More in depth example.
public class Parent()
{
public Guid ID { get; set; }
public string Name { get; set; }
}
public class Child()
{
public Guid ID { get; set; }
public Parent Parent { get; private set; }
public int ChildProp { get; set; }
}
I’ll give the credit to this post correct answer(in green), for helping me figure it out.
http://forums.asp.net