TableQueryquery = new TableQuery () .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "sales")) .Select(new string[] { "LastName", "FirstName", "Email" }); foreach (CustomerEntity entity in cloudTable.ExecuteQuery(query)) { Console.WriteLine("{0}, {1}: {2}", entity.LastName, entity.FirstName, entity.Email); }
TableQueryThis example shows how to use TableQuery to retrieve log data from an Azure storage table. The query retrieves all log entries with a PartitionKey of "2019-10-01" and a RowKey greater than or equal to "000050". The results are printed to the console with the timestamp, type, and message for each log entry. Overall, the Microsoft.WindowsAzure.Storage.Table library provides a powerful way to query Azure storage tables using LINQ-style syntax.query = new TableQuery () .Where(TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "2019-10-01"), TableOperators.And, TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, "000050"))); foreach (LogEntity entity in cloudTable.ExecuteQuery(query)) { Console.WriteLine("[{0}] {1}: {2}", entity.Timestamp, entity.Type, entity.Message); }