/// <summary> /// Applies row key prefix criteria to given queryable which allows to query a range of rows /// </summary> /// <typeparam name="TEntity">The type of the entity to return.</typeparam> /// <param name="queryable">The queryable.</param> /// <param name="prefix">The row key prefix.</param> /// <returns>An instance of <see cref="IQueryable"/> that alllow further criterias to be added</returns> public static IQueryable <TEntity> WhereRowKeyPrefix <TEntity>(this IQueryable <TEntity> queryable, string prefix) where TEntity : ITableEntity, new() { var range = new PrefixRange(prefix); return(queryable.Where(x => x.RowKey.CompareTo(range.Start) >= 0 && x.RowKey.CompareTo(range.End) < 0)); }
static string WhereRowKeyPrefixFilter(string prefix) { var range = new PrefixRange(prefix); var filter = TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, range.Start), TableOperators.And, TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThan, range.End)); return(filter); }