HODI 2.1.1
dotnet add package HODI --version 2.1.1
NuGet\Install-Package HODI -Version 2.1.1
<PackageReference Include="HODI" Version="2.1.1" />
paket add HODI --version 2.1.1
#r "nuget: HODI, 2.1.1"
// Install HODI as a Cake Addin
#addin nuget:?package=HODI&version=2.1.1
// Install HODI as a Cake Tool
#tool nuget:?package=HODI&version=2.1.1
HODI
Higher Order Dependency Injection
HODI is a set of functions designed to be simple and consistent with a minimal implementation.
The purpose of this library is to make unit testing of functions used as HTTP handlers in F# web applications more straightforward.
Install
PM> Install-Package HODI
or...
dotnet add package HODI
Defining Handlers
Instead of...
let oldWayHandler : HttpHandler =
fun (next: HttpFunc) (ctx: HttpContext) ->
task {
let dep = ctx.GetService<Dependency>()
// ...
}
this can be done...
let anotherWayHandler : HttpHandler =
fun (dep: Dependency) (next: HttpFunc) (ctx: HttpContext) ->
task {
// ...
}
Usage
The functions can be used when defining routes.
let app =
choose [
route "/a" >=> exampleHandler |> inject
route "/b" >=> handlerWith2Dependencies |> inject2
routef "/c/%s" >=> handlerWithArgumentAndDependency |> injectPlus
]
Unit Testing
When unit testing the HTTPHandler functions, you could simply pass the dependencies without having to set up a test server. In other words, the tests can focus on the handlers behavior instead of caring about dependency injection.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- FSharp.Core (>= 6.0.0 && <= 7.0.400)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
net6.0
- FSharp.Core (>= 6.0.0 && <= 7.0.400)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
net7.0
- FSharp.Core (>= 6.0.0 && <= 7.0.400)
- Microsoft.AspNetCore.Http (>= 2.2.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.1 | 123 | 8/15/2023 |
2.0.6 | 237 | 1/21/2023 |
2.0.5 | 241 | 1/21/2023 |
2.0.3 | 254 | 1/21/2023 |
2.0.1 | 342 | 10/26/2022 |
2.0.0 | 403 | 4/3/2022 |
1.2.5 | 390 | 4/3/2022 |
1.2.4 | 401 | 4/2/2022 |
1.2.3 | 388 | 4/2/2022 |
1.2.2 | 287 | 9/28/2021 |
1.2.0 | 296 | 4/26/2021 |
1.1.1 | 284 | 4/24/2021 |
1.1.0 | 284 | 4/22/2021 |
1.0.3 | 294 | 4/22/2021 |
1.0.2 | 350 | 4/18/2021 |
1.0.1 | 296 | 4/16/2021 |
1.0.0 | 304 | 4/16/2021 |