1
I have an application that makes the deserialization of an XML file.
I managed a class with from an XSD with XSD.EXE
For deserialization I use the following code:
static T LoadFromXMLString<T>(string xmlText)
{
var stringReader = new System.IO.StringReader(xmlText);
var serializer = new XmlSerializer(typeof(T));
return (T)serializer.Deserialize(stringReader);
}
I call him as follows:
var _ProcNFe = LoadFromXMLString<ProcNFe.TNfeProc>(XmlProcNFe);
After that, I use the object _ProcNFe
to save some fields to the database.
However, a doubt has arisen, the XSD I originally used will be changed and consequently the generated class as well.
What would be correct, create a new class from this new version of XSD or change the existing one to conform to the new XSD?
I advise creating a new class and working with versioning, just like NF-e is also versioned (valid).
– Ismael
In this case, I believe you need to have a mapping between the file and a class so you can manipulate your data and update the database. So every time the file changes, you would need to have a class to represent it.
– Angelo Belchior