首页 \ 问答 \ Microsoft Bond架构演变最佳实践(Microsoft Bond schema evolution best practices)

Microsoft Bond架构演变最佳实践(Microsoft Bond schema evolution best practices)

Microsoft Bond是否有一些关于模式如何随时间演变的最佳实践? 我想确保我们遵循最佳实践,以便我们具有双向兼容性(即允许我们的Bond类型将旧版本发展到当前版本,以及向后兼容性允许从较新版本转换回旧版本)。 我没有在文档中具体说明这一点(例如https://microsoft.github.io/bond/manual/bond_cs.htmlhttps://microsoft.github.io/bond/manual/compiler.html#idl -syntax ),尽管其他序列化框架(例如Avro)在其文档中明确详细说明了这一点。

对于它的价值,我们用.NET编写(C#/ F#)并打算最初使用CompactBinaryWriter和CompactBinaryReader格式。

例如,我想象一下这些方面的一些指导:

  1. 字段名称可以随着时间的推移而变化,因为字段序数用于字段解析,而不是直接名称(SimpleJSON除外)。 我相信这是真的,是吗?
  2. 添加新的“必需”字段需要您为该字段指定默认值
  3. 如果旧版本分配了默认值,则删除较新版本中的字段是可以的
  4. 那么改变一个领域的类型呢? 例如,字段是否可以从版本1中的字符串字段更改为版本2中的int64? 它可以从字符串更改为自定义联合(具有可选字段的自定义类型)吗?
  5. 还有其他建议吗?

谢谢!

如果有这种类型的Microsoft Bond问题有任何活跃的论坛社区,我也会感兴趣,我无法找到一个......


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.

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. 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?
  2. adding a new "required" field requires you give the field a default value
  3. removing a field in a newer version is okay, provided older versions had a default value assigned
  4. 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)?
  5. any other recommendations?

Thank you!

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...


原文:https://stackoverflow.com/questions/41860787
更新时间:2023-07-08 21:07

最满意答案

使用$location.path()

来自文档

$ location服务解析浏览器地址栏中的URL(基于window.location),并使URL可供您的应用程序使用。

...

Getter和setter方法

// get the current path
$location.path();

在控制器中使用

angular.module("app").controller("RecordsController", function($http, $routeParams, $location){
   var path = $location.path();
   // Do something with `path` ...       

});

演示

http://plnkr.co/edit/SoRmRFl7gJMxmJ9bXzgS?p=preview


Use $location.path()

from the docs:

The $location service parses the URL in the browser address bar (based on window.location) and makes the URL available to your application.

...

Getter and setter methods

// get the current path
$location.path();

To use in your controller

angular.module("app").controller("RecordsController", function($http, $routeParams, $location){
   var path = $location.path();
   // Do something with `path` ...       

});

Demo

http://plnkr.co/edit/SoRmRFl7gJMxmJ9bXzgS?p=preview

相关问答

更多
该ui-view内部没有ui-view ,ui-router也不知道你希望子视图去哪里......因此它不会渲 ...
  • 所以问题是我如何构建我的模块。 我不能确切地告诉你我做错了什么,因为我还不清楚模块是如何工作的。 我做的是减少应用程序,直到我开始工作并逐个添加东西,直到我发现破坏应用程序的东西。 So the problem was how I was constructing my module. I can't tell you exactly what I did wrong because I don't yet understand exactly how modules work. What I did wa ...
  • 如果您已经在路线中定义了控制器,则不需要在html模板中定义控制器,使用值形式html模板删除ng-controller属性然后运行它将只运行一次 if you already define your controller in route you dont need to define controller in html template remove the ng-controller attribute with value form html template then run it will r ...
  • 可能是错的,因为主页不在描述中,但我猜在主页中,你缺少ng-view指令。 因此,不能注入模板。 你应该有类似的东西: 或者,如果你body标签下已经有一些元素:
    ... Might be wrong because the home page is not in the description, but I'm guessing that in the home page, ...
  • 应该能够使用$location.path('/search/query')来做到这一点 function getSearchResults(searchRequest) { return $http.post('search/query', searchRequest, {}).then(function (response) { myEsResults = response.data; $location.path('/search/query'); ...
  • 相关文章

    更多
  • Interviewing at Microsoft
  • 摘抄---Multimedia Streaming on Microsoft Windows CE 3.0
  • Solr Configuration Best Practices and Troubleshooting Tips
  • Hadoop——Microsoft大数据战略的核心
  • 《微软Windows 8新特性和功能教程》(VTC.com Microsoft Windows 8 Introduction Course)[光盘镜像]
  • USER AND SCHEMA
  • solr schema
  • Hibernate的最佳实践
  • SOLR企业搜索平台 三 (schema.xml配置和solrj的使用)
  • MySQL最佳实践
  • 最新问答

    更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)