这是一个示例代码:
[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"}
在没有手动更改的情况下,它是否可行?