Hi I am trying out simple Azure Function with REST Api. My env is MSVC 2019 and created a simple mmApi Fucntion app
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using AzureFuncApp.Model;
using System.Collections.Generic;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage;
namespace AzureFuncApp
{
public static class mmApi
{
//static List<Board> boards = new List<Board>();
[FunctionName("CreateBoard")]
public static async Task<IActionResult> CreateBoard(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "board")] HttpRequest req,
[Table("boards", Connection ="AzureWebJobsStorage")] IAsyncCollector<BoardTableEntity> boardTable,
ILogger log)
{
log.LogInformation("Creating a new board.");
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var input = JsonConvert.DeserializeObject<BoardCreateModel>(requestBody);
var board = new Board() { PlayerCount = input.PlayerCount };
board.Players.Add(input.Player);
await boardTable.AddAsync(board.ToTableEntity());
return new OkObjectResult(board);
}
It is this line that I have added to Table Storage [Table("boards", Connection ="AzureWebJobsStorage")] IAsyncCollector
Is throwing the below error
Function (AzureFuncAppmmApi/CreateBoard) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'CreateBoard'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'boardTable' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
What I am not following is where do I register builder.AddAzureStorage() when I don't have the startup file in my project.
Attached is my project details, any help and pointer is appriciated