WCF 服务向后兼容性检查
我刚刚编写了 WCF Web 服务的新版本,我想确保我没有对服务和数据契约进行任何重大更改。
回想一下我作为 VB6 Com Api 开发人员的日子,我记得在编译时指定组件的先前发行版本,并让编译器检查是否保持了二进制兼容性是多么容易。
我设想了类似的东西(希望)称为“合同兼容性”检查。 它将使用元数据执行与 VB6 开发环境类似的检查。 这可以作为执行实用程序的单独构建步骤来完成。
我准备承认不存在这样的实用程序。 如果是这样的话,有人对实现这一目标的算法有什么想法吗?
- 从当前实时服务版本中检索
- 元数据 从新服务版本中检索元数据
- 检查服务合同和每个数据合同的兼容性。 仅报告重大变更。
第 3 步看起来很复杂,但肯定可以自动化......
I have just written a new version of a WCF web service and I want to make sure that I have not made any breaking changes with regard to Service and Data contracts.
Thinking back to my days as a VB6 Com Api developer I recall how easy it was to specify the previous release version of the component at compile time, and have the compiler check that binary compatibility is being maintained.
I envisage something similar called (hopefully) a “Contract Compatibility” check. It would use the metadata to perform a similar check to the one that the VB6 dev env did. This could be done as a separate build step that would execute a utility.
I am prepared to accept that there exists no such utility out there. If that is the case, does anyone have any ideas about how the algorithm to achieve this would look?
- Retrieve metadata from current live service version
- Retrieve meta data from new service version
- Check Service Contract and each Data Contract for compatibility. Only reporting breaking changes.
Step 3 seems like it would be complex but certainly automatable...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这些情况可以通过集成/回归测试来解决。 您为初始版本编写集成测试,将服务修改为新版本后,使用旧客户端再次运行集成测试。 如果他们成功了,你就不会破坏任何东西。 如果失败,您可以准确地看到是什么调用导致了问题。
These situations are solved by integration/regression testing. You write integration tests for initial version and after modifying service to new version you run integration tests again using old client. If they success you didn't break anything. If they fail you see exactly what calls caused problems.
Andy 不存在这样的东西,但是如果你启动并运行了一些东西,其中你有 2 个 DLL(一个旧的和一个新的),那么你可以使用类似 BitDiffer 的东西来比较它们。
Codeplex 上有一个项目可以帮助发布 WCF,但我不记得它叫什么了,抱歉。
祝你好运,
-基思
Nothing like that exists Andy but if you get something up and running whereby you have 2 DLLs (one old and one new), you could then use something like BitDiffer to compare them.
There was a project on Codeplex that helped with WCF releases, but I can't remember what it is called, sorry.
Good luck,
-Keith
请参阅“版本控制 WCF 服务:第一部分” 和 “WCF 服务版本控制:第二部分” 。
See "Versioning WCF Services: Part I" and "Versioning WCF Services: Part II".
尝试使用旧接口合约的 "Codeplex WCF 负载测试" 生成单元测试,并在新接口合约上运行它们:
Try to generate unit tests using "Codeplex WCF Load Test" for old interface contract and run them on a new one: