C# 使用非类型化模型将表单发布到WebAPI OData控制器

C# 使用非类型化模型将表单发布到WebAPI OData控制器,c#,json,asp.net-web-api,odata,C#,Json,Asp.net Web Api,Odata,我的edm中有一个非类型化模型,定义如下: <EntityType Name="Content"> <Key> <PropertyRef Name="Id"/> </Key> <Property Name="Id" Type="Edm.Guid"/> <Property Name="Title" Type="Edm.String"/> </EntityType> 这在json中工作得很好

我的edm中有一个非类型化模型,定义如下:

<EntityType Name="Content">
  <Key>
    <PropertyRef Name="Id"/>
  </Key>
  <Property Name="Id" Type="Edm.Guid"/>
  <Property Name="Title" Type="Edm.String"/>
</EntityType>
这在json中工作得很好-实体中充满了属性,但odata反序列化器似乎不理解application/x-www-form-urlencoded mime类型

<form method="POST" action="http://localhost/api/odata/content">
    Title:<br>
    <input type="text" name="Title" value="Mouse">
    <br>
    <input type="submit" value="Submit">
</form> 

标题:


是的,WebApi OData不支持此格式,您可以检查代码 和规格

或者您可以自定义格式化程序,这可能很难,但任何进一步的问题或请求都可能在github中出现问题

<form method="POST" action="http://localhost/api/odata/content">
    Title:<br>
    <input type="text" name="Title" value="Mouse">
    <br>
    <input type="submit" value="Submit">
</form>