Oaf 0.0.2-preview1

This is a prerelease version of Oaf.
dotnet add package Oaf --version 0.0.2-preview1
                    
NuGet\Install-Package Oaf -Version 0.0.2-preview1
                    
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="Oaf" Version="0.0.2-preview1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oaf" Version="0.0.2-preview1" />
                    
Directory.Packages.props
<PackageReference Include="Oaf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oaf --version 0.0.2-preview1
                    
#r "nuget: Oaf, 0.0.2-preview1"
                    
#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.
#:package Oaf@0.0.2-preview1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oaf&version=0.0.2-preview1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Oaf&version=0.0.2-preview1&prerelease
                    
Install as a Cake Tool

AspNetCore On Azure Functions (AspNetCore OAF)

This library provides mechanisms to proxy all HTTP requests handled by the standalone (out of process) C# function worker into the AspNet Core pipeline.

For now, it's a toy that's being used for non-critical deployments (staging/pre-prod sites). It's not 'supported' and you shouldn't use it

Usage

Create a IHostBuilder as usual for your function worker. At the end, call UseOaf<TSTartup>(). The TStartup type is the same startup type that is used when configuring the web host for a normal AspNetCore project. No further configuration is required (or supported).

public static async Task Main(string[] args)
{
    var host = CreateApiHostBuilder(args)   // Your centralized IHostBuilder logic
        .ConfigureFunctionsWorkerDefaults() // Wire up isolated function worker
        .UseOaf<Startup>()                  // Wire up Oaf with your AspNetCore startup class
        .Build();

    await host.RunAsync();
}

Optional In your function project's host.json configure it so that we can match unprefixed routes:

{
    "extensions": {
        "http": {
            "routePrefix": ""
        }
    }
}

Upon starting the function app, you should see a wildcard HTTP function to handle the requests. All requests will route to that function and be processed through the AspNetCore pipeline, allowing you to take advantage of standard middleware, authentication, and other things (such as Swagger/OpenAPI).

Azure Functions Core Tools
Core Tools Version:       3.0.3442 Commit hash: 6bfab24b2743f8421475d996402c398d2fe4a9e0  (64-bit)
Function Runtime Version: 3.0.15417.0


Functions:

        AspNetCore: [GET,POST,PUT,DELETE,OPTIONS,HEAD,PATCH] http://localhost:7071/{*route}
        
For detailed output, run func with --verbose flag.
[2021-08-12T03:36:33.170Z] Azure Functions .NET Worker (PID: 12345) initialized in debug mode. Waiting for debugger to attach...
[2021-08-12T03:36:38.229Z] Host lock lease acquired by instance ID '0000000000000000000000000007224C'.
[2021-08-12T03:36:46.252Z] Worker process started and initialized.
[2021-08-12T03:36:46.870Z] info: Microsoft.Hosting.Lifetime[0]
[2021-08-12T03:36:46.871Z]       Application started. Press Ctrl+C to shut down.
[2021-08-12T03:36:46.872Z] info: Microsoft.Hosting.Lifetime[0]
[2021-08-12T03:36:46.873Z]       Hosting environment: Production
[2021-08-12T03:36:46.874Z] info: Microsoft.Hosting.Lifetime[0]
[2021-08-12T03:36:46.875Z]       Content root path: (null)

Publishing for Azure Functions

When publishing, specify a Runtime Identifier and set the OafPublish property to any non-empty value. Example:

dotnet publish -r linux-x64 -p:OafPublish=true --output api_publish .\src\FunctionAPI\FunctionAPI.csproj

The above settings and the MSBuild targets/props shipped with the nuget package will create a runtime-specific output that is R2R, while not being single file.

Not being a 'single file' output is important as the function runtime inspects the accompanying dll files.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.0.2-preview1 318 9/26/2022