Unfortunately, the answer to this question is not as simple and understandable as you can hope for. Serializers sometimes need tips on how to match the textual representation of your data with the representation of conceptual objects (and vice versa). This most often refers to XML than JSON, because it is more structured (elements, attributes, namespaces, schema, etc.). You probably refer to the example of creating an EF model that you specified, not for serialization, but for a mapping / relational schema that is very different from XML serialization.
Even tools like JSON.NET have the attributes that are needed when the names of your serialized members don't quite match the properties of your object, and you don't want to write your own converter.
If attribute pollution really bothers you, you can introduce another layer between the models and the XML. You can then have types that contain attributes and serve the sole purpose of serializing in and out of XML, and then use a tool like AutoMapper or ValueInjecter to convert from this layer to your model layer.
I also donβt always like attributes that pollute my types, for example, with MVC model validation attributes and especially for providing EF tips on how my entity model compares with the relational schema. However, this is one example where I think it might be appropriate because you get a lot from it with a fairly minimal amount of code.
There seems to be at least one free XML serialization tool, but I'm not sure how good it is:
https://fluentlyxml.codeplex.com/
http://trycatchfail.com/blog/post/fluent-xml-serializatione28093introduction.aspx
source share