Multiple filter conditions Azure table storage

后端 未结 5 765
半阙折子戏
半阙折子戏 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:29

    Just handling the case of a new query that does not have a filter already and based on @LivingOnACloud, I would rather write it this way:

     public static TableQuery AndWhere(this TableQuery query, string filter)
                where TElement : ITableEntity,new ()
            {
                if (query.FilterString.IsNullOrEmpty())
                {
                    query.FilterString =  filter;
                }
                else
                {
                    query.FilterString = TableQuery.CombineFilters(query.FilterString, TableOperators.And, filter);
                }
                return query;
            }
    

    And the rest follow the same check, things can go nicer.

提交回复
热议问题