Support for bindings and IBinder interface in Azure Functions .NET isolated worker as they appear in WebJobs.
$ dotnet add package Axion.Azure.Functions.Worker.Extensions.BindingSupport for output bindings and IBinder interface in Azure Functions .NET isolated worker as they appear in WebJobs.
services.AddWorkerBinding();
public class Service(IBinder binder)
{
public async Task Run()
{
var attribute = new BlobAttribute("samples-workitems/sample.txt", FileAccess.Write)
{
Connection = "AzureWebJobsStorage"
};
using var writer = await binder.BindAsync<TextWriter>(attribute, CancellationToken.None);
await writer.WriteLineAsync($"Log entry created at: {DateTime.Now}");
}
}
[Blob("samples-workitems/sample.txt", FileAccess.Write)]
class Poco
{
public string Content { get; set; }
}
public class Service(ITypeBinder binder)
{
public async Task Run()
{
var collector = await BindAsync<IAsyncCollector<Poco>>();
await collector.AddAsync(new Poco { Content = $"Log entry created at: {DateTime.Now}" });
}
}