Waystone.Monads.Extensions.Hosting
7.0.0-beta.3
See the version list below for details.
dotnet add package Waystone.Monads.Extensions.Hosting --version 7.0.0-beta.3
NuGet\Install-Package Waystone.Monads.Extensions.Hosting -Version 7.0.0-beta.3
<PackageReference Include="Waystone.Monads.Extensions.Hosting" Version="7.0.0-beta.3" />
<PackageVersion Include="Waystone.Monads.Extensions.Hosting" Version="7.0.0-beta.3" />
<PackageReference Include="Waystone.Monads.Extensions.Hosting" />
paket add Waystone.Monads.Extensions.Hosting --version 7.0.0-beta.3
#r "nuget: Waystone.Monads.Extensions.Hosting, 7.0.0-beta.3"
#:package Waystone.Monads.Extensions.Hosting@7.0.0-beta.3
#addin nuget:?package=Waystone.Monads.Extensions.Hosting&version=7.0.0-beta.3&prerelease
#tool nuget:?package=Waystone.Monads.Extensions.Hosting&version=7.0.0-beta.3&prerelease
Waystone.Monads.Extensions.Hosting
Installs the container-registered Waystone.Monads configuration from the host's
own start-up sequence.
Waystone.Monads.Extensions.DependencyInjection splits registration from
installation, because configuration registered on an IServiceCollection needs
services the container has not built yet. That leaves an application holding a
second call it has to remember:
var app = builder.Build();
app.Services.UseWaystoneMonads(); // easy to forget
Forgetting it is silent — the library keeps working on its defaults. This package removes the call rather than relying on anybody to remember it.
Install and configure
dotnet add package Waystone.Monads.Extensions.Hosting
builder.AddWaystoneMonads(options => options.UseFallbackErrorCode("Contoso"));
var app = builder.Build();
// No second call.
That is AddWaystoneMonads on IHostApplicationBuilder, which both
WebApplicationBuilder and the builder from Host.CreateApplicationBuilder
implement. It is exactly the two calls below, spelled once.
An overload hands your delegate the host's built provider, which is how you point a companion package at something the container holds:
builder.AddWaystoneMonads((provider, options) =>
options.UseFallbackErrorCode("Contoso")
.UseLoggerFactoryFrom(provider));
UseLoggerFactoryFrom ships from Waystone.Monads.Extensions.Logging. Nothing
but ErrorCodeFactory is resolved for you, so the package you installed is the
one you call.
On the older IHostBuilder, which has no such interface, reach the same pair
through ConfigureServices:
new HostBuilder().ConfigureServices(
services => services
.AddWaystoneMonads(options => options.UseFallbackErrorCode("Contoso"))
.EnableInstallOnStart());
EnableInstallOnStart hangs off the MonadServicesBuilder that
AddWaystoneMonads returns, so asking for the install without first asking for
the registration does not compile. It registers the installer and nothing else,
so AddWaystoneMonads is still where configuration goes.
Calling it twice installs once — the registration is deduplicated on the implementation type.
Registration order does not matter
The install runs in IHostedLifecycleService.StartingAsync, which the host calls
on every hosted service before it calls StartAsync on any of them. So a
background service that reads MonadOptions in its own StartAsync sees the
installed configuration whether it was registered before EnableInstallOnStart
or after.
That is the whole reason this is a lifecycle service rather than a plain
IHostedService. A plain one would install in StartAsync, in registration
order, and a service registered ahead of it would read the defaults.
Work done before the host starts is still too early. A read taken while the
service collection is being populated, or between Build() and Run(), runs
ahead of every hosted service. Such a read is answered from the defaults and
reported through the Waystone.Monads.ConfigurationNotApplied diagnostic event,
exactly as it is without this package. Configuration is applied at host start, not
at container build.
Without a host
Nothing here applies. Call UseWaystoneMonads() on the provider yourself —
Waystone.Monads.Extensions.DependencyInjection is all a console application, a
test, or a container built by hand needs.
| 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. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.0
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.2)
- Waystone.Monads.Extensions.DependencyInjection (>= 7.0.0-beta.3)
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 |
|---|---|---|
| 7.3.0 | 41 | 9/13/2026 |
| 7.2.0 | 78 | 9/9/2026 |
| 7.1.0 | 97 | 9/4/2026 |
| 7.1.0-beta.2 | 55 | 9/3/2026 |
| 7.1.0-beta.1 | 70 | 9/2/2026 |
| 7.0.1 | 93 | 8/30/2026 |
| 7.0.0 | 91 | 8/30/2026 |
| 7.0.0-beta.3 | 70 | 8/29/2026 |