Simple data file versioning with DataContractSerializer

后端 未结 2 1906
不知归路
不知归路 2021-01-05 08:37

Having read Data Contract Versioning we concluded that it\'s not really the whole story. For example, what happens if you used to have ValueA, and in the new version it\'s n

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 09:08

    I think you're expecting too much from the built-in versioning support. It's really intended to allow you to add new members while retaining all existing functionality and therefore members.

    In the case of breaking changes to a contract, you'd probably be better creating a new version of the contract (e.g. using a new namespace - a common convention is to use a suffix yyyy/mm, e.g. http://mycompany.com/myservices/2009/10).

    You then need to be able to support as many old contracts as is appropriate, and need to be able to convert between each supported contract and whatever current internal representation you are using.

提交回复
热议问题