0
Reply

Serializing an entity class to xml

Gary Semel

Gary Semel

Feb 8 2007 12:08 AM
2k
I'm serializing a class to xml using the XmlSerializer. The entity class has public properties that are populated from a sql server table row. The entity's property values are referential "codes" (e.g. "A" or "RTOSEND") instead of the associated descriptive values (A->Nylon or RTOSEND->Ready To Send). We use lookups to do these translations in other parts of the code, but the entity has the raw values. The problem is that the serialized xml has the raw code values, but we want to output the descriptive (lookup) values in the xml. It doesn't help us to have A when we really need to see Nylon. How do people usually handle this type of data serialization? I suppose I could create a TranslatedEntity class whose properties are the descriptive lookup values, and serialize that. Any suggestions? Thanks! Gary