从WCF服务暴露枚举的DescriptionAttributeWCF、DescriptionAttribute

2023-09-03 06:46:00 作者:情绪操控生活

我怎么能公开枚举值描述属性的服务使用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).

 
精彩推荐