Officium.Tools
2.1.0
dotnet add package Officium.Tools --version 2.1.0
NuGet\Install-Package Officium.Tools -Version 2.1.0
<PackageReference Include="Officium.Tools" Version="2.1.0" />
paket add Officium.Tools --version 2.1.0
#r "nuget: Officium.Tools, 2.1.0"
// 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 | Versions 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. |
-
- Microsoft.AspNetCore.Http (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection (>= 2.2.0)
- Newtonsoft.Json (>= 11.0.2)
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 | 603 | 9/11/2019 |
2.0.0 | 540 | 9/9/2019 |
1.1.4-alpha | 376 | 9/1/2019 |
1.1.3-alpha | 364 | 8/31/2019 |
1.0.2-alpha | 394 | 8/31/2019 |
1.0.1-alpha | 378 | 8/30/2019 |
1.0.0 | 579 | 8/26/2019 |
0.0.2-alpha | 397 | 8/24/2019 |
0.0.1-alpha | 372 | 8/16/2019 |
Added HaltExecution , and OnHanderExecuted