这是一个示例代码:
[DataContract]
public enum SessionOperation
{
[EnumMember]
Update,
[EnumMember]
Register
}
[DataContract]
public class RequestObject
{
[DataMember]
public long ClientId { get; set; }
[DataMember]
public long SessionId { get; set; }
[DataMember]
public SessionOperation Operation { get; set; }
}
及运营合同:
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
BaseResponseObject Request(SessionData requestObject);
我试图在我的 RESTful WCF 服务中实现的是将 SessionOperation 作为字符串而不是作为值传递?喜欢:
{"ClientId": 11935,"SessionId": 635193261351796051, "Operation": "Register"}
没有手动更改是否有可能?