马克弃用字段中的WCF合同 [英] Mark deprecated fields in WCF contract

查看:154
本文介绍了马克弃用字段中的WCF合同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF的合同,与客户V1的作品。

I have a wcf contract that works with client v1.

现在我工作的服务v2和我要将某些字段为弃用,因此客户端V1将看到并使用它们,和客户端V2将忽略它们。

Now I'm working on service v2, and i want to mark some of the fields as deprecated, So client v1 will see and use them, and client v2 will ignore them.

是否有此问题的最佳做法?是否有WCF的所有现有属性,我应该使用?

Are there any best practices for this issue? Are there any existing attributes in WCF that i should use?

感谢。

推荐答案

您可以装饰你的旧属性 [作废] 但客户端只能看到他们,如果他们使用DLL引用,而不是服务/ Web引用(WSDL)。 [作废] 装修将不会被传递到使用WSDL生成代理客户端

You can decorate your old properties as [Obsolete] but the client will only see them if they use a DLL reference and not service/web reference (WSDL). [Obsolete] decoration will not be passed to the client that uses WSDL to generate the proxy.

在WCF版本而言,一旦你已经发表的接口,你不能删除任何方法或在合同条款,你真的应该不会删除任何属性。你可以发布一个新的接口,并创建如果你想新的客户端使用它们单独DTO类

In terms of WCF versioning, once you have published an interface, you cannot remove any methods or in terms of contract you should really not remove any properties. You can publish a new interface and create a separate DTO class if you want new clients to use them.

参考:的过时属性

这篇关于马克弃用字段中的WCF合同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆