删除OData中带有复合主键的记录

时间:2019-05-28 12:28:39

标签: rest asp.net-web-api2 odata asp.net-web-api-odata

我有一个实体学生。下面是ASP.net WebAPI中用于OData的delete方法的签名。

public async Task<IHttpActionResult> Delete([FromODataUri] int key)

学生具有复合主键。 当邮递员致电时,

http://localhost:52484/Students/1

它没有点击Delete方法。 但是它可以与具有单个主键的其他实体一起使用。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

请为复合键实体的param加上'key'前缀。 OData v4

请参考以下示例:

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

OData网址 http://localhost:52484/Student(SudentId=1,ClassId=2)

相关问题