我正在寻找关于WCF绑定主题的一些很好的技术细节,我有兴趣知道以下事情.
我通过互联网浏览了不同的材料,但它没有详细而且有些分散.等待一些好的回应.
我打算写一个宁静的API,我的要求是在"Transaction"对象上调用方法,我想知道如何使用适当的URI模板调用Post/PUT,以便我可以创建/更新Transaction资源而不使用"verbs"在Uri映射.
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/Transaction/{**What to write here ????**}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public Transaction AddTransaction(Transaction transaction)
{
return AddTransactionToRepository(transaction);
}
[OperationContract]
[WebInvoke(Method = "PUT", UriTemplate = "/Transaction/{**What to write here ????**}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public Transaction UpdateTransaction(Transaction transaction)
{
return UpdateTransactionInRepository(transaction);
}
Run Code Online (Sandbox Code Playgroud)
请考虑我想为uri映射应用最佳实践,并且不要在其中使用"动词",只需要"名词".还告诉我客户端如何使用唯一URI访问Post和Put的这些方法.谢谢