我試圖通過我的WCF REST Web服務公開一個枚舉。只顯示一個屬性。詳情請參閱下文。任何人都可以建議爲什麼發生這種情況?通過WCF Rest公開一個枚舉。只顯示一個屬性
類
[DataContract]
public enum OrderAttributes
{
[EnumMember]
AppointmentRef,
[EnumMember]
AddressRef,
[EnumMember]
ContactEmail,
[EnumMember]
ContactFirstName
}
接口
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "OrderAttributes")]
[OperationContract(Name = "OrderAttributes")]
DataLayer.OrderAttributes OrderAttributes();
服務
[PrincipalPermission(SecurityAction.Demand, Role = "Administrators")]
DataLayer.OrderAttributes IService.OrderAttributes() {
return new OrderAttributes();
}
結果的獲得
<OrderAttributesResponse>
<OrderAttributesResult>AppointmentRef</OrderAttributesResult>
</OrderAttributesResponse>
刪除datacontract屬性給出了相同的結果 –