I have binary serialized objects in database. They are serialized with protobuf. Now I need to generate some viewer to see the content of Database. So, i read stream from database and deserialized it back to the objects. It works and the result is list of objects:
var dbData = readData(someType);//it is IList collection
Now, I would like to save this list of objects to file to see the content of database. I thought it would be the best to save it to xml. So, i have tried:
var serializer = new XmlSerializer(dbData.GetType());
But i get an error: Cannot deserialize type 'My.Entities.IdBase' because it contains property 'Key' which has no public setter.
What now? I can't change the class definitions to have setters. Should i save objects to json or plain text instead? Or should i extract all properties and values and save it to some xml? Any code example?