Closed flycast closed 2 years ago
Branch issues/other/i563 created!
Ah indeed @flycast since you have a reference/class-based property and a list of said property (or two of them), they can have the same reference occur within the same graph. In order to proceed in this scenario, you can use EnableReferences
. Passing test with your described model here:
However, since you are creating a new list with each and every call to the Key
property I would definitely put that under an ignored call. In addition to the XmlIgnore
attribute you can configure it on the container as such:
var subject = new ConfigurationContainer().EnableReferences()
.Type<Subject>()
.Member(x => x.Key)
.Ignore()
.Create();
Please do let me know if that helps you out and/or if you have any additional questions and I'll see if I can further assist.
Yes, helps immensely. Thanks.
Going through items here in this repository and I see that this is an open ticket that appears to be answered/solved. If this is not the case, please do let me know by either commenting on this ticket or opening a new one, and I will do my best to assist. Closing for now.
I have two properties:
I have a third property that is read only that is made of a combination of ParentKey and Id:
When I serialize I get the following exceptions:
If I use the attribute [XmlIgnore] the object serializes although without the Key property.
Are these really circular? They are related - 'Key' is made with 'ParentKey' and 'Id' but neither 'ParentKey' or 'Id' is made with Key.