我想創建兩個Rest方法,這些方法根據URI中的查詢字符串參數而有所不同。Rest方法因查詢字符串參數而異
像
[WebGet(UriTemplate = "Guest/{guestId}?day={day}&type={type}")]
[OperationContract(Name = "GetDetailByDayAndActivity")]
public GuestDetail GetDetail(string guestId, DateTime day, string type)
[WebGet(UriTemplate = "Guest/{guestId}?day={day}")]
public GuestDetail GetDetail(string guestId, DateTime day)
這給了錯誤:
"Operation 'GetDetailByDayAndActivity' in contract 'IRestService' has a UriTemplate that expects a parameter named 'TYPE', but there is no input parameter with that name on the operation. "
訪問一個只有像白天參數的方法時:http://testserver/GuestService/Guest/0?day=2011-10-20
如何才能實現這一目標?
老兄!我遇到了同樣的問題。看着你的回答,讓我意識到我在做同樣的錯誤事情,並責怪除了我之外的任何東西!謝謝! –