简体   繁体   English

Azure Table Storage Service 2.0区分大小写的筛选器

[英]Azure Table Storage service 2.0 case sensitive filter

How to perform case sensitive filter On Azure Table storage 2.0 ? 如何在Azure Table storage 2.0上执行区分大小写的筛选器?

If i do this query 如果我这样做查询
TableQuery.GenerateFilterCondition("ShortUrl", QueryComparisons.Equal, "Abc");

It will returns 2 records with shortUrl "Abc" and "ABC" 它将返回带有shortUrl“ Abc”和“ ABC”的2条记录
The generated query show like this 生成的查询显示如下

/devstoreaccount1/Articles?$filter=shortUrl%20eq%20%27Abc%27&timeout=90

There is a solution for version 1.7 shown here , but this is not applicable on version 2.0. 这里是显示1.7版本的解决方案在这里 ,但这并不适用于2.0版本。 I have checked DataService Documentation and it is not mentioned there. 我已经检查了DataService文档 ,那里没有提到。

Since Table storage queries based on OData Protocol, why it behaves different when comparing string values. 由于表存储基于OData协议进行查询,因此在比较字符串值时为何其行为不同。 I am sure the Odata "eq" operator is supposed to be case sensitive. 我确定Odata“ eq”运算符应该区分大小写。
Check OData Api Explorer with this query 使用此查询检查OData Api Explorer

http://services.odata.org/V3/OData/OData.svc/Products?$filter= Name eq 'Bread'

Then change it to bread. 然后将其更改为面包。

As per documentation here : 根据此处的文档:

All parts of the filter string are case-sensitive. 过滤器字符串的所有部分均区分大小写。

So I suggest that you try a real table storage, not the Development Storage. 因此,我建议您尝试使用真正的表存储,而不是开发存储。 If you find this behavior on the real Storage service, please write here again, the team will be alerted! 如果您在真正的存储服务上发现此行为,请再次在此处写信,团队将收到警报!

Also please use the latest SDK/Tools (currently 2.0). 另外,请使用最新的SDK /工具(当前为2.0)。 If you find this behavior in development storage 2.0, update your question again, this might be a bug in the Development Storage. 如果在Development Storage 2.0中发现此行为,请再次更新您的问题,这可能是Development Storage中的错误。

But in any case, I suggest that you use real storage account when testing such "sensitive" features. 但是无论如何,我建议您在测试这种“敏感”功能时使用真实的存储帐户。 I almost never use Development Storage account. 我几乎从不使用开发存储帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM