Multiple filter conditions Azure table storage

后端 未结 5 922
半阙折子戏
半阙折子戏 2021-02-02 06:43

How can I set multiple filters on a Azure Table Storage?

This is what I\'ve tried:

string partitionFilter = TableQuery.GenerateFilterCondition(\"Partitio         


        
5条回答
  •  情书的邮戳
    2021-02-02 07:31

    How can I set multiple filters on a Azure Table Storage?

    I was wondering the same thing. I wrote an extension to the TableQuery class which works fine.

    It's an easy change which makes me wonder if we are going about querying with multiple filters incorrectly.

    public static class TableQueryExtensions 
    {
        public static TableQuery AndWhere(this TableQuery @this, string filter)
        {
            @this.FilterString = TableQuery.CombineFilters(@this.FilterString, TableOperators.And, filter);
            return @this;
        }
    
        public static TableQuery OrWhere(this TableQuery @this, string filter)
        {
            @this.FilterString = TableQuery.CombineFilters(@this.FilterString, TableOperators.Or, filter);
            return @this;
        }
    
        public static TableQuery NotWhere(this TableQuery @this, string filter)
        {
            @this.FilterString = TableQuery.CombineFilters(@this.FilterString, TableOperators.Not, filter);
            return @this;
        }
    }
    

提交回复
热议问题