C# 带小数的.NET OData错误:类型不匹配
我目前正在尝试消除OData错误,它看起来像是十进制解析/反序列化的问题 我的ASP.NET MVC应用程序中有正在使用的OData API(使用System.Web.Http.OData库),用户可以下载指向所述OData API的OData提要文件*.odc。当ODataAPI响应中存在小数时,例如C# 带小数的.NET OData错误:类型不匹配,c#,.net,asp.net-mvc,excel,odata,C#,.net,Asp.net Mvc,Excel,Odata,我目前正在尝试消除OData错误,它看起来像是十进制解析/反序列化的问题 我的ASP.NET MVC应用程序中有正在使用的OData API(使用System.Web.Http.OData库),用户可以下载指向所述OData API的OData提要文件*.odc。当ODataAPI响应中存在小数时,例如 <d:Value m:type="Edm.Decimal">50.50</d:Value> 有趣的是,当十进制值没有小数部分时,没有错误,如下所示: <d:Val
<d:Value m:type="Edm.Decimal">50.50</d:Value>
有趣的是,当十进制值没有小数部分时,没有错误,如下所示:
<d:Value m:type="Edm.Decimal">50.00</d:Value>
50.00
以下是完整的API响应(去掉URL):
http://schemas.datacontract.org/2004/07/
2016-06-22T11:01:10Z
xxxxx
2016-06-22T11:01:10Z
001
在里面
山姆
单位
2016-06-06T00:00:00
真的
50.50
50.50
API响应中的小数有什么问题,有没有办法解决?有没有人遇到过类似的问题并设法解决了
<d:Value m:type="Edm.Decimal">50.00</d:Value>
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="xxxxxxxxx" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://schemas.datacontract.org/2004/07/</id>
<title />
<updated>2016-06-22T11:01:10Z</updated>
<link rel="self" href="xxxxxxxxxxxxx" />
<entry>
<id>xxxxx</id>
<category term="Itm.Erp.Domain.Finance.CashRegistryListView" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="xxxx" />
<link rel="self" href="xxxx" />
<title />
<updated>2016-06-22T11:01:10Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Number>001</d:Number>
<d:Location m:null="true" />
<d:Direction>In</d:Direction>
<d:Person>Sam</d:Person>
<d:Company>Company</d:Company>
<d:Date m:type="Edm.DateTime">2016-06-06T00:00:00</d:Date>
<d:IsProcessed m:type="Edm.Boolean">true</d:IsProcessed>
<d:ExpenseType m:null="true" />
<d:Value m:type="Edm.Decimal">50.50</d:Value>
<d:EffectiveValue m:type="Edm.Decimal">50.50</d:EffectiveValue>
<d:Seller m:null="true" />
<d:DocumentNumber m:null="true" />
</m:properties>
</content>
</entry>
</feed>