I have the following entity classes, which are mapped from virtually identical view model classes:
public class Node
{
public IList<Node> Children { get; set; }
public Node Parent { get; set; }
public string Text { get; set; }
}
public class Tree
{
public Node Root { get; set; }
}
Using the following view model structure
Tree
-> Root
-> Children { node1, node2 }
Once the view model is mapped to the entity, the first child node, of the root node, is the root node and, as a result, I’m getting an infinite loop when I traverse the entity object structure.
Anybody have an idea why this is happening and how to resolve it?
Many thanks
Steve
Something like that schould work as the AutoMapper Configuration.
PS: I did not try it by now, but as I use the AutoMapper very often I think it should work.