C#模型.
var asset = new Asset() { Id = Guid.NewGuid().ToString(),Name = "Cool Asset Yo",Url = "http://test/test.asset",Tags = new[] {"test"},Properties = new Dictionary<string,string> { {"platform","android"},{"dim_depth","1.0"},{"dim_height",{"dim_width",{"item_type","Trim"} } }
返回JSON
[ { "name": "Cool Asset Yo","properties": { "platform": "android","dim_depth": "1.0","dim_height": "1.0","dim_width": "1.0","item_type": "Trim" },"tags": [ "test" ],"url": "http://test/test.asset","id": "77d9b9df-4f4b-4fad-a1d3-af5075d52a62",} ]
示例查询有效!
> api / Asset?$filter = startswith(name,’Cool’)
> api / Asset?$filter = tags / any(tag eq’test’)
> api / Asset?$filter = id eq’77d9b9df-4f4b-4fad-a1d3-af5075d52a62′
现在失败:-(
> api / Asset?$filter = properties / platform eq’Android’
>错误:属性“platform”的属性访问的父值不是单个值.属性访问只能应用于单个值.
> api / Asset?$filter = properties / any(道具:道具/平台eq’Android’)
>错误:无法在类型’System.Collections.Generic.keyvaluePair_2OfString_String’上找到名为’platform’的属性.
> api / Asset?$filter = properties / any(keyvalue:keyvalue(‘platform’)eq’Android’)
>错误:找到名为’keyvalue’的未知函数.这也可能是导航属性上的函数导入或键查找,这是不允许的.
> api / Asset?$filter = properties / any(keyvalue:keyvalue eq’Android’)
>错误:检测到具有不兼容类型的二元运算符.找到操作数类型’System.Collections.Generic.keyvaluePair_2OfString_String’和’Edm.String’,用于运算符类’Equal’.
> api / Asset?$filter = properties [‘platform’] eq’Android’
>错误:’properties [‘platform’] eq’Android”中第31位的语法错误.
如何获得“Android”平台的资产列表?我看到在模型中使用的Microsoft Documents通用字典中的示例,我没有看到任何$filter示例.