Best practice to serialize and deserialize .net objects across versions

后端 未结 2 977
一个人的身影
一个人的身影 2021-02-10 02:52

Objects are serialized to a database using the .NET XML serializer. The object can change over time, and therefore multiple versions exist in the database at one time.

A

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-10 03:18

    Have a schema version number in the serialized object. Using custom deserialization, check the version attribute first, and if it turns out to be an old version, upgrade it to the latest schema before deserializing.

提交回复
热议问题