Schema.NET
Schema.NET copied to clipboard
XML Serialisation
Describe the feature
Hi;
Has anyone had any success serialising any of the POCO classes to XML? I've tried both XmlSerializer and DataContractSerializer, but they both freak out for different reasons.
Is there something simple I'm missing?
Schema objects
No response
Hey @SmithPlatts - haven't actually tried XML serialization before. I imagine it may have some trouble with our OneOrMany and Values types without some dedicated serializer for the,. If there are just some attributes we need to set on properties, that could be something easy enough for us to apply to the library though.
Hi @Turnerj, cheers for opening the conversation.
I was actually thinking of giving that a go in my branch, and if it works without impacting the perf of the library, was going to open a PR for your review and comment.
I don't imagine the existing performance of the library would be impacted - like if we just need extra attributes, that's effectively a no-op in terms of performance. If we need a new XML-based serializer, that's a bit more work and more tests to do it thoroughly. Really hoping we can get away with just some attributes etc to decorate properties!
I've encountered circumstances where even attributes can change the compiler behaviour, and introduce a regression; not common, but I'm an overly defensive developer 😂
Happy to investigate the matter, and start with attributes. If a serialiser is also required, will be adding it test-first.
I'll let you know how things go.