Microsoft Bond架构演变最佳实践(Microsoft Bond schema evolution best practices)
Microsoft Bond是否有一些关于模式如何随时间演变的最佳实践? 我想确保我们遵循最佳实践,以便我们具有双向兼容性(即允许我们的Bond类型将旧版本发展到当前版本,以及向后兼容性允许从较新版本转换回旧版本)。 我没有在文档中具体说明这一点(例如https://microsoft.github.io/bond/manual/bond_cs.html或https://microsoft.github.io/bond/manual/compiler.html#idl -syntax ),尽管其他序列化框架(例如Avro)在其文档中明确详细说明了这一点。
对于它的价值,我们用.NET编写(C#/ F#)并打算最初使用CompactBinaryWriter和CompactBinaryReader格式。
例如,我想象一下这些方面的一些指导:
- 字段名称可以随着时间的推移而变化,因为字段序数用于字段解析,而不是直接名称(SimpleJSON除外)。 我相信这是真的,是吗?
- 添加新的“必需”字段需要您为该字段指定默认值
- 如果旧版本分配了默认值,则删除较新版本中的字段是可以的
- 那么改变一个领域的类型呢? 例如,字段是否可以从版本1中的字符串字段更改为版本2中的int64? 它可以从字符串更改为自定义联合(具有可选字段的自定义类型)吗?
- 还有其他建议吗?
谢谢!
如果有这种类型的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:
- 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?
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
满意答案
使用
$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` ... });
演示
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
相关问答
更多Angular的ng-view中的控制器定义(Controller definition inside Angular's ng-view)
Angular - 从控制器内部指令接收信息(Angular - receiving info from controller inside directive)
控制器未被调用(Controller not being called)
在Angular中,如何找到从控制器内部“调用”控制器的路径?(In Angular, how to find the route that “called” the controller from inside the controller?)
Angular ui route不会激活控制器(Angular ui route doesn't activate the controller)
Angular app无法在transclude上找到控制器(Angular app can't find controller on transclude)
Angular JS控制器被调用两次(ng-controller)(Angular JS controller called twice (ng-controller))
Angular JS:未调用路由提供程序控制器方法?(Angular JS: Route provider controller method not called?)
从角度服务调用角度路径以加载新视图和控制器(invoking an angular route from angular service to load a new view and controller)
相关文章
更多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最佳实践
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!