FunctionMigration.Extensions 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FunctionMigration.Extensions --version 0.3.0                
NuGet\Install-Package FunctionMigration.Extensions -Version 0.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FunctionMigration.Extensions" Version="0.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FunctionMigration.Extensions --version 0.3.0                
#r "nuget: FunctionMigration.Extensions, 0.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FunctionMigration.Extensions as a Cake Addin
#addin nuget:?package=FunctionMigration.Extensions&version=0.3.0

// Install FunctionMigration.Extensions as a Cake Tool
#tool nuget:?package=FunctionMigration.Extensions&version=0.3.0                

FunctionMigration.Extensions

A collection of tools, shims, and facades to help make migrating Azure Functions to .NET 7 easier

NuGet Package

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?

  1. HTTP triggered functions that return IActionResult
  2. Functions that bind to an ICollector or IAsyncCollector parameter to interact with an Azure Storage Queue
  3. Functions that bind to an IAsyncCollector parameter to interact with an Azure ServiceBus Queue or Topic

What's planned

  • Analyzers and code fixers to help identify changes to be made and help you apply fixes quickly.
  • Headers write methods so you can re-use Headers syntax used with HttpRequest
  • Docs with step-by-step instructions to migrate to the new project format
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.6 226 6/10/2023
0.3.5 289 4/13/2023
0.3.3 181 4/13/2023
0.3.2 206 4/13/2023
0.3.1 339 3/18/2023
0.3.0 259 3/11/2023
0.2.0 314 2/21/2023
0.1.1 321 2/2/2023
0.1.0 294 1/31/2023