FunctionMigration.Extensions
0.3.3
See the version list below for details.
dotnet add package FunctionMigration.Extensions --version 0.3.3
NuGet\Install-Package FunctionMigration.Extensions -Version 0.3.3
<PackageReference Include="FunctionMigration.Extensions" Version="0.3.3" />
paket add FunctionMigration.Extensions --version 0.3.3
#r "nuget: FunctionMigration.Extensions, 0.3.3"
// Install FunctionMigration.Extensions as a Cake Addin #addin nuget:?package=FunctionMigration.Extensions&version=0.3.3 // Install FunctionMigration.Extensions as a Cake Tool #tool nuget:?package=FunctionMigration.Extensions&version=0.3.3
A collection of tools, shims, and facades to help make migrating Azure Functions to .NET 7 easier
The Problem
You need to migrate your project to .NET 7 and Azure Functions or Azure Static Websites with .NET 7. The syntax for writing functions with C# and .NET 7 is significantly different due to the isolated model for Azure Functions.
Consider syntax like the following that works properly in Azure Functions in-process mode with .NET 6:
[FunctionName("GetClips")]
public async Task<IActionResult> GetClips(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
ILogger log)
{
string channelName = req.Form["ChannelName"];
var top = await _ClipRepository.GetTopClips(channelName, 300);
return new OkObjectResult(new ClipsPayload
{
Data = top,
TotalClips = top.Count()
});
}
There's so much I like about this method working in Azure Functions... and so much is broken in isolated mode. This library will help you apply those repairs with minimal changes to your original code.
With the 0.1 version, the above function can be adapted to this format and behave the same:
[FunctionName("GetClips")]
public async Task<HttpResponseData> GetClips(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequestData req)
{
string channelName = req.Form("ChannelName");
var top = await _ClipRepository.GetTopClips(channelName, 300);
return req.OkObjectResult(new ClipsPayload
{
Data = top,
TotalClips = top.Count()
});
}
What's in the package?
- A collection of extension methods for HttpRequestData to allow similar ActionResult method types that you may have previously been using
- Extension methods that allow access to Query, Form, and Headers using similar syntax to what you previously used with HttpRequest
- QueueCollector class that will help you replace Queue bindings quickly with ICollector / IAsyncCollector syntax
- ServiceBusCollector class that will help you replace ServiceBus bindings quickly with IAsyncCollector syntax
- Global FunctionName alias that re-routes your existing FunctionName attributes to the new Function attribute. No re-write needed
What migrations are supported?
- HTTP triggered functions that return IActionResult
- Functions that bind to an
ICollector
orIAsyncCollector
parameter to interact with an Azure Storage Queue - Functions that bind to an
IAsyncCollector
parameter to interact with an Azure ServiceBus Queue or Topic
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Azure.Messaging.ServiceBus (>= 7.12.0)
- Azure.Storage.Queues (>= 12.11.1)
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
- Microsoft.Azure.Functions.Worker (>= 1.10.0)
- Microsoft.Azure.Functions.Worker.Extensions.Http (>= 3.0.13)
- Microsoft.Azure.WebJobs.Core (>= 3.0.33)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.