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

相关问答

更多

Angular的ng-view中的控制器定义(Controller definition inside Angular's ng-view)

该错误表示当/ Angular首次尝试使用它时,控制器尚未实例化。 我的猜测是你在ngRoute定义中引用控制器,而ngRoute模块试图在显示你的视图之前覆盖控制器依赖。 如果您要更新问题以包含路由配置,那可能会更加明显。 工作(或非工作)的Plnkr.co演示会更好。 I created an issue on Github for this: https://github.com/angular/angular.js/issues/11384. Turns out this scenario...

Angular - 从控制器内部指令接收信息(Angular - receiving info from controller inside directive)

在不知道确切用例的情况下,我的方法是定义一个新的范围属性,例如play : "=" (将视频结束时设置为停止),以及$observe attrs.play或$scope.$watch "play"它。 在模板中,将其绑定到由控制器触发的$ scope变量。 <video-item play="videoControls.play"></video-item> 这是一个使用双向绑定的plunker,请注意您不必做任何事情: http://plnkr.co/edit/3OI801KcvYVoySDv...

控制器未被调用(Controller not being called)

要创建控制器,您必须: angular.module('yourApp').controller('homeIndexController', function () { }); 这告诉角度“嘿,我有一个名为'homeIndexController'的控制器,随时可以在某处使用它。” To create a controller, you have to do: angular.module('yourApp').controller('homeIndexController', functi...

在Angular中,如何找到从控制器内部“调用”控制器的路径?(In Angular, how to find the route that “called” the controller from inside the controller?)

使用$location.path() 来自文档 : $ location服务解析浏览器地址栏中的URL(基于window.location),并使URL可供您的应用程序使用。 ... Getter和setter方法 // get the current path $location.path(); 在控制器中使用 angular.module("app").controller("RecordsController", function($http, $routeParams, $locatio...

Angular ui route不会激活控制器(Angular ui route doesn't activate the controller)

由于您的视图是嵌套的,因此您需要具体应将子状态视图插入父状态视图的位置。 根据您在问题中提供的代码,您的父状态视图如下所示 <div ng-repeat="make in makes | orderBy: 'name'"> <a ui-sref="modal.models({make: make._id})"> <li>{{make.name}}</li> </a> </div> 该ui-view内部没有ui-view ,ui-router也不知道你希望子视图去哪里......因...

Angular app无法在transclude上找到控制器(Angular app can't find controller on transclude)

所以问题是我如何构建我的模块。 我不能确切地告诉你我做错了什么,因为我还不清楚模块是如何工作的。 我做的是减少应用程序,直到我开始工作并逐个添加东西,直到我发现破坏应用程序的东西。 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 d...

Angular JS控制器被调用两次(ng-controller)(Angular JS controller called twice (ng-controller))

如果您已经在路线中定义了控制器,则不需要在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 w...

Angular JS:未调用路由提供程序控制器方法?(Angular JS: Route provider controller method not called?)

可能是错的,因为主页不在描述中,但我猜在主页中,你缺少ng-view指令。 因此,不能注入模板。 你应该有类似的东西: <body ng-view></body> 或者,如果你body标签下已经有一些元素: <body> <div ng-view></div> ... </body> Might be wrong because the home page is not in the description, but I'm guessing that in the home ...

从角度服务调用角度路径以加载新视图和控制器(invoking an angular route from angular service to load a new view and controller)

应该能够使用$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

转自:http://www.cnblogs.com/GT_Andy/archive/2010/02/0 ...

摘抄---Multimedia Streaming on Microsoft Windows CE 3.0

Multimedia Streaming on Microsoft Windows CE 3.0 ...

Solr Configuration Best Practices and Troubleshooting Tips

https://support.datastax.com/entries/38367716-Solr- ...

Hadoop——Microsoft大数据战略的核心

如今,Microsoft已经将Hadoop作为自身大数据战略的核心。Microsoft此举的理由就是看 ...

《微软Windows 8新特性和功能教程》(VTC.com Microsoft Windows 8 Introduction Course)[光盘镜像]

中文名: 微软Windows 8新特性和功能教程 英文名: VTC.com Microsoft ...

USER AND SCHEMA

官方文档里面说得比较明白,schema是数据对象的集合,包括像表、视图、索引、同义词等等都可以说是sc ...

solr schema

1.schema.xml注意确定文档唯一性的field的indexed属性必须为true solrc ...

Hibernate的最佳实践

使用Hibernate的最佳实践,1、在做关系尽可能使用单向关联,不要使用双向关联, 2、在大项目中( ...

SOLR企业搜索平台 三 (schema.xml配置和solrj的使用)

标签: solrj 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处、作者信息 ...

MySQL最佳实践

MySQL是我们最常见且常用的关系型数据库之一,其相关的优化和最佳实践的tips,网上早已泛滥了,但其 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本