[ServiceContract]
public interface IProduct
{
//REST 四个 GET POST PUT DELETE
[OperationContract] //注意.NET3.5必须要带这个 4.0 开始就可以取消了
[WebGet(UriTemplate = "all", ResponseFormat = WebMessageFormat.Xml)]
List<Product> GetAll();
[OperationContract]
[WebGet(UriTemplate = "{id}")]
Product Get(string id);
//添加 其中路径为/
[OperationContract]
[WebInvoke(UriTemplate = "/", Method = "POST")]
void Create(Product product);
//更新
[OperationContract]
[WebInvoke(UriTemplate = "/", Method = "PUT")]
void Update(Product product);
//删除
[OperationContract]
[WebInvoke(UriTemplate = "{id}", Method = "DELETE")]
void Delete(string id);
}
我想问的问题:
1.GetAll方法中的参数可以为实体对象吗?
2.WebInvoke底下修饰的增删改方法可以有返回值吗?返回值类型有限制吗?