So according to this issue on GitHub, support for IQueryable
was dropped for v2 Azure Functions. This is also reflected in the official docs. That doc also mentions that CloudTable
could be used to bind to Table storage, however no specific information or examples are provided.
In a minimal working example, how would a Table Storage binding for a v2 Azure Function look like (for, say, reading all rows of a table from table storage)?
Any help is highly appreciated!
10
votes
1 Answers
16
votes
Should be as simple as
[FunctionName("TestFunction")]
public static async Task Run(
[QueueTrigger("test-queue")] string message,
[Table("testTable")] CloudTable testTable)
{
var querySegment = testTable.ExecuteQuerySegmentedAsync(new TableQuery<ResultEntity>(), null);
foreach (ResultEntity item in querySegment.Result)
{
// Access table storage items here
}
}
A full working example is available here.