casting int to string in OData raises error

2019-08-19 12:43发布

why the cast is not working here?

http://services.odata.org/Northwind/Northwind.svc/Orders?$filter=startswith(cast(OrderID, 'Edm.String'),'1')

it says:

No coercion operator is defined between types 'System.Int32' and 'System.String'.

1条回答
Evening l夕情丶
2楼-- · 2019-08-19 13:32

OData doesn't support conversion to and from string. It supports conversions between related entity types and between numeric primitive types only. See http://msdn.microsoft.com/en-us/library/dd541472(v=PROT.10).aspx and the castExpression paragraph. It's very similar to the cast operator in C# for example.

查看更多
登录 后发表回答