问题描述
Microsoft Bond是否具有有关架构如何随着时间演变的最佳实践?我想确定我们遵循最佳实践,这样我们就具有2种方式的兼容性(即允许我们的Bond类型将较旧的版本演化为当前版本,以及向后的兼容性允许从较新版本转换为较旧版本).我在文档中没有看到专门解决的问题(例如 https://microsoft.github .io/bond/manual/bond_cs.html 或 https ://microsoft.github.io/bond/manual/compiler.html#idl-syntax ),尽管其他序列化框架(例如Avro)在其文档中也对此进行了详细说明.
Does Microsoft Bond have some best practices on how schemas evolve over time? I want to make certain we follow best practices such that we have 2 way compatibility (i.e. allowing our Bond types to evolve older versions to the current version, as well as backward compatibility allowing conversion from a newer version back to an older version). I don't see this addressed specifically in the documentation (e.g. https://microsoft.github.io/bond/manual/bond_cs.html nor https://microsoft.github.io/bond/manual/compiler.html#idl-syntax ), though other serialization frameworks such as Avro have this explicitly detailed in their documentation.
对于它的价值,我们正在用.NET(C#/F#)编写,打算最初使用CompactBinaryWriter和CompactBinaryReader格式.
For what it's worth, we are writing in .NET (C#/F#) and intend to use the CompactBinaryWriter and CompactBinaryReader formats initially.
例如,我想像一些指导方针:
For example, I imagine some guidance along these lines:
- 由于字段序号用于字段解析,而不是直接使用名称(),因此
- 字段名称会随时间而变化.我相信这是真的吗?
- 添加新的必填"字段需要您为该字段提供默认值
- 在较新版本中删除字段是可以的,只要较旧的版本已指定默认值
- 如何更改字段的类型?例如,字段可以从版本1的字符串字段更改为版本2的int64吗?它可以从字符串更改为自定义联合(具有可选字段的自定义类型)吗?
- 还有其他建议吗?
- names of fields can change over time since the field ordinals are used for field resolution, not the names directly (except in SimpleJSON). I believe this true, is it?
- adding a new "required" field requires you give the field a default value
- removing a field in a newer version is okay, provided older versions had a default value assigned
- what about changing the type of a field? For example, can a field change from an string field in version 1 to a int64 in version 2? Can it change from a string to a custom union (custom type with optional fields)?
- any other recommendations?
谢谢!
如果对于这种类型的Microsoft Bond问题是否有任何活跃的论坛社区,我也将不感兴趣,我找不到一个...
would also be interested if there is any active forum community for this type of Microsoft Bond question, i wasn't able to find one...
推荐答案
现在可以在以下位置找到Bond模式的演变规则和最佳实践: https://microsoft.github.io/bond/manual/bond_cpp. html#schema-evolution https://microsoft.github.io/bond/manual/bond_cs. html#schema-evolution
The Bond schema evolution rules and best practices can now be found here:https://microsoft.github.io/bond/manual/bond_cpp.html#schema-evolutionhttps://microsoft.github.io/bond/manual/bond_cs.html#schema-evolution
这篇关于Microsoft Bond模式演变最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!