Normally in a .NET Core project I would create a \'boostrap\' class to configure my service along with the DI registration commands. This is usually an extension method of
The newly released version 1.1.0 of Microsoft.Azure.Functions.Extensions allows you to do the following:
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
var configuration = builder.GetContext().Configuration;
builder.Services.AddCosmosDbService(configuration);
}
}
Unfortunately it still does not support async configuration so you will still have to block waiting for the task to finish or use the trick described by @Nkosi