OData POST 未使用 Asp.Net ApiController 设置对象的最后一个 属性

OData POST doesn't set last property of object using a Asp.Net ApiController

我有以下 xml 文档,该文档已提交 ( POST ),其中包含 System.Web.Http.ApiController.

控制器的代码(POST)非常基础:

   <ResponseType(GetType(Representative))>
    Function PostRepresentative(ByVal model As Representative) As IHttpActionResult
        If Not ModelState.IsValid Then
            Return BadRequest(ModelState)
        End If

        RepresentativeRepository.Add(model)
        UnitOfWork.Commit()
        '   db.Representative.Add(Representative)
        '   db.SaveChangesAsync()

        Return CreatedAtRoute("DefaultApi", New With {.id = model.Id}, model)
    End Function

这是我在 POST

中提交的文件
<?xml version="1.0" encoding="UTF-8"?>
<Representative xmlns="http://schemas.datacontract.org/2004/07/Omnisoft.Domain.Slave" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <Id>8</Id>
     <Commission>10</Commission>
     <Email />
     <receiveInvoice>true</receiveInvoice>
     <receiveDeliveryNotice>true</receiveDeliveryNotice>
     <receiveEstimate>true</receiveEstimate>
     <receiveOrderConfirmation>true</receiveOrderConfirmation>
     <receiveRappel>true</receiveRappel>
     <receiveCollectedBilling>true</receiveCollectedBilling>
     <receiveWorkOrder>false</receiveWorkOrder>
     <Name>TESTING</Name>
</Representative>

这是我对应的型号:

 Public Class Representative
    <Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)> _
    Public Property Id As Integer

    Public Property Name As String

    <LocalizedDisplayName("Commission", NameResourceType:=GetType(ViewRes.RepresentativeValue))>
    Public Property Commission As Double

    <DataType(DataType.EmailAddress)> _
    Public Property Email As String

    Public Property receiveEstimate As Boolean
    Public Property receiveOrderConfirmation As Boolean
    Public Property receiveDeliveryNotice As Boolean
    Public Property receiveInvoice As Boolean
    Public Property receiveCollectedBilling As Boolean
    Public Property receiveWorkOrder As Boolean
    Public Property receiveRappel As Boolean

End Class

当 xml 文档将 Name 作为最后一个 属性 时,它不会在模型中提交。当它在 XML 文件的顶部提交时。 Odata可以"parse/serialize" 属性 没有问题。

否则,我添加的实体包含 Name 的 nil 值。

知道这可能是什么吗?

我使用了一个不同的 xml 序列化程序并且它起作用了。