Officium.Tools 2.1.0

dotnet add package Officium.Tools --version 2.1.0
NuGet\Install-Package Officium.Tools -Version 2.1.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="Officium.Tools" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Officium.Tools --version 2.1.0
#r "nuget: Officium.Tools, 2.1.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 Officium.Tools as a Cake Addin
#addin nuget:?package=Officium.Tools&version=2.1.0

// Install Officium.Tools as a Cake Tool
#tool nuget:?package=Officium.Tools&version=2.1.0

Officium

Overview

Officium is a suite of tools for rapid development of Azure Http triggered functions using existing IoC frameworks

Quick start

Prerequisites

Setup your Azure Function to Use Dependency injection https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection

Add a reference to Offcium.Tools

Install-Package Officium.Tools

Steps

Add 2 line to your Azure startup file (in the configure method)

 public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            builder.Services.AddPlugins(); // find and register all classes implementing 'IFunctionPlugin'
            builder.Services.AddOficuimServices(); // add the services we'll need
        }
    }

Add a constructor to your azure function , with a private field

private readonly IExecutor executor;

   public Function1(IExecutor executor)
   {
      this.executor = executor;
   } 

In the Run method, Add a line to start routing requests to your handlers

public IActionResult Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "v1/{n1?}")] HttpRequest req,
        ILogger log)
        {           
            return executor.ExecuteRequest(req, log);
        }

Finally add your handler

public class HelloWorldPlugin : IFunctionPlugin
{
    public PluginStepOrder StepOrder => PluginStepOrder.OnGet; // run this on every get request

    public IActionResult ExecuteRequest(HttpRequest req, ILogger logger, IPluginContext context)
    {
        string name = req.Query["name"];
        return name != null
            ? (ActionResult)new OkObjectResult($"Hello, {name}")
            : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 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
2.1.0 561 9/11/2019
2.0.0 515 9/9/2019
1.1.4-alpha 351 9/1/2019
1.1.3-alpha 332 8/31/2019
1.0.2-alpha 369 8/31/2019
1.0.1-alpha 354 8/30/2019
1.0.0 543 8/26/2019
0.0.2-alpha 376 8/24/2019
0.0.1-alpha 351 8/16/2019

Added HaltExecution , and OnHanderExecuted