public async Task CanFilterByColumn() { var account = CloudStorageAccount.DevelopmentStorageAccount; await LoadBooksAsync(TableRepository.Create <Book>(account, nameof(CanFilterByColumn), x => x.Author, x => x.ISBN)); var repo = TablePartition.Create <Book>(account, nameof(CanFilterByRowKey), "Rick Riordan", x => x.ISBN); // Get specific set of books from one particular publisher/country combination // in this case, 978-[English-speaking country, 1][Disney Editions, 4231] // See https://en.wikipedia.org/wiki/List_of_group-1_ISBN_publisher_codes var query = from book in repo.CreateQuery() where book.Pages >= 1000 && book.Pages <= 1500 select new { book.ISBN, book.Title }; var result = await query.AsAsyncEnumerable().ToListAsync(); Assert.Single(result); }
public async Task CanProjectPartition() { var account = CloudStorageAccount.DevelopmentStorageAccount; // Load with author + isbn as keys await LoadBooksAsync(TableRepository.Create <Book>(account, nameof(CanProjectPartition), x => x.Author, x => x.ISBN)); // Query single author by scoping to partition key var repo = TablePartition.Create <Book>(account, nameof(CanProjectPartition), "Rick Riordan", x => x.ISBN); var hasResults = false; await foreach (var info in from book in repo.CreateQuery() where book.Format == BookFormat.Hardback && book.IsPublished select new { book.ISBN, book.Title }) { hasResults = true; Assert.NotNull(info.ISBN); Assert.NotNull(info.Title); } Assert.True(hasResults); }