Exposing the DescriptionAttribute of Enums from a WCF Service

后端 未结 3 934
予麋鹿
予麋鹿 2021-01-22 11:58

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

how can i expose enum with description attribute to client

3条回答
  •  悲&欢浪女
    2021-01-22 12:50

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

    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).

提交回复
热议问题