我有類似這樣的界面:WCF RESTful服務使用界面與泛型
[ServiceContract]
public interface IBaseService<T>
{
[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
List<T> LoadById(string value);
[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
List<T> Load(string field, string value);
}
這些方法會在幾個服務中實現。實施的一個例子是這樣的:
[ServiceContract]
[ServiceKnownType(typeof(ObjectDTO))]
public interface IObjectService : IBaseService<ObjectDTO>
{
}
我的問題是,是否有可能使用使用在基本的服務接口的OperationContracts UriTemplates這個架構設定RESTful服務?我試着四處搜尋,但沒有看到其他人試圖以這種方式設置他們的RESTful服務。
+1 @Anton:嘿,告訴我們你真的*認爲! – 2010-02-15 14:17:51
@Ruben嗯......你是什麼意思? – 2010-02-15 14:18:33
我鼓掌稱,本着自以爲是的框架精神,您以這樣明確的詞語陳述您的答案。 (也就是說,翻譯爲「不要阻止男人 - 你現在努力想成爲PC」)(並且想要同時推薦一個好的答案) – 2010-02-15 14:25:49