从WCF服务暴露枚举的DescriptionAttribute [英] Exposing the DescriptionAttribute of Enums from a WCF Service

查看:332
本文介绍了从WCF服务暴露枚举的DescriptionAttribute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能公开枚举值描述属性的服务使用WCF客户端或Web参考    或

how can i expose description attribute in enum values from service to client or web reference using WCF or

使用WCF我怎么能揭露枚举与描述属性客户端?同时露出Description属性不外露仅枚举值都暴露在客户端。我想在枚举说明attribue值。

how can i expose enum with description attribute to client using WCF? while exposing Description attribute is not exposed only enum values are exposed in client. I want value in description attribue in enums.

推荐答案

你不能强迫这 - 的MEX / WDSL描述只包含与类型相关联的信息的微小的子集

You can't force this - the mex/WDSL descriptors only contain a tiny subset of the information associated with a type.

如果你控制客户端,一个选项是声明枚举(甚至所有类型)在当地,并从那里消费。您应该能够使用SvcUtil工具/参考:切换到从现有的组件使用类型(IDE中提供相同)。但是请注意,这(即您使用的不是服务合同承诺的更多信息)部分打破SOA的规则。

If you control the client, one option is to declare the enum (or even all the types) locally, and consume from there. You should be able to use the svcutil /reference: switch to use types from an existing assembly (the IDE offers the same). But note that this partly breaks the rules of SOA (i.e. you are using more information than the service contract promises).

这篇关于从WCF服务暴露枚举的DescriptionAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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