Get all records from azure table storage
You're using wrong class. Use TableQuery to retrieve multiple results. https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.table.tablequery.aspx
If you need further control over the records being returned, you can use ExecuteQuerySegmentedAsync
to retrieve data a page (around 1,000 records) at a time.
var alerts = new List<ServiceAlertsEntity>();
var query = new TableQuery<ServiceAlertsEntity>();
TableContinuationToken continuationToken = null;
do
{
var page = await table.ExecuteQuerySegmentedAsync(query, continuationToken);
continuationToken = page.ContinuationToken;
alerts.AddRange(page.Results);
}
while (continuationToken != null);
Or if you need to restrict your results, e.g. by Partition Key, you can add a filter condition by adding a Where
clause to the query in the above code.
var pk = "abc";
var filterPk = TableQuery.GenerateFilterCondition(
nameof(ServiceAlertsEntity.PartitionKey),
QueryComparisons.Equal, pk);
var query = new TableQuery<ServiceAlertsEntity>().Where(filterPk);
MS Azure reference
You need to specify a TableQuery, this will give you all entities or you can specify a TableQuery.GenerateFilterCondition
to filter the rows.
TableQuery<ServiceAlertsEntity> query = new TableQuery<ServiceAlertsEntity>();
foreach (ServiceAlertsEntity entity in table.ExecuteQuery(query))
{
Console.WriteLine("{0}, {1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey,
entity.Field1, entity.Field2);
}