我同意 Henk van Boeijen 的观点。我想补充一点,如果您使用 Web Api 端点,也可以通过在请求的标头中添加“Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue" 来实现。
HTTP/1.1 200 OK
Content-Type: application/json; odata.metadata=minimal
OData-Version: 4.0
Preference-Applied: odata.include-annotations="OData.Community.Display.V1.FormattedValue"
{
"@odata.context": "[Organization URI]/api/data/v8.2/$metadata#accounts(name,donotpostalmail,accountratingcode,numberofemployees,revenue)",
"value": [
{
"@odata.etag": "W/"502170"",
"name": "Fourth Coffee (sample)",
"donotpostalmail@OData.Community.Display.V1.FormattedValue": "Allow",
"donotpostalmail": false,
"accountratingcode@OData.Community.Display.V1.FormattedValue": "Default Value",
"accountratingcode": 1,
"numberofemployees@OData.Community.Display.V1.FormattedValue": "9,500",
"numberofemployees": 9500,
"revenue@OData.Community.Display.V1.FormattedValue": "$100,000.00",
"revenue": 100000,
"accountid": "89390c24-9c72-e511-80d4-00155d2a68d1",
"transactioncurrencyid_value": "50b6dd7b-f16d-e511-80d0-00155db07cb1" } ]
}
更多详情:https ://msdn.microsoft.com/en-us/library/gg334767.aspx