Asp.net web api 如何使用OData4和WebApi实现无类型实体模型的修补程序?
在使用OData4和WebApi创建一个无类型的实体模型时,我正在为修补程序而挣扎。 我已创建此控制器方法:Asp.net web api 如何使用OData4和WebApi实现无类型实体模型的修补程序?,asp.net-web-api,odata,Asp.net Web Api,Odata,在使用OData4和WebApi创建一个无类型的实体模型时,我正在为修补程序而挣扎。 我已创建此控制器方法: [HttpPatch] public IHttpActionResult Patch([FromODataUri] int key, Delta<EdmEntityObject> delta) { // ... } { "error": { "code": "", "message": "The request entity's media type
[HttpPatch]
public IHttpActionResult Patch([FromODataUri] int key, Delta<EdmEntityObject> delta)
{
// ...
}
{
"error": {
"code": "",
"message": "The request entity's media type 'application/json' is not supported for this resource.",
"innererror": {
"message": "No MediaTypeFormatter is available to read an object of type 'Delta`1' from content with media type 'application/json'.",
"type": "System.Net.Http.UnsupportedMediaTypeException",
"stacktrace": " at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"
}
}
}