Invex.Extensions.Hosting Documentation
Invex.Extensions.Hosting is a small, focused library of utilities for
Microsoft.Extensions.Hosting
that fills three common gaps in the generic host programming model:
| Feature | Problem it solves |
|---|---|
| Multi-interface registration | Registering one implementation under several service types without creating duplicate instances. |
| Host control | Stopping the application gracefully with a specific process exit code. |
| Cycle background service | Running periodic background work on a fixed, drift-free cadence. |
Contents
Guides
- Getting started — installation, supported frameworks, and a 5-minute tour.
- Multi-interface registration —
AddSingleton,AddScoped, andAddHostedServiceoverloads that forward multiple service types to a single shared instance. - Host control —
IHostControlfor graceful shutdown with exit codes. - Cycle background service —
CycleBackgroundServicefor periodic work.
API reference
The full API reference lives in the api/ directory:
Design principles
- Tiny surface area. The library exposes exactly four public types. Everything else is internal.
- No behavioral surprises. All extensions compose the standard
Microsoft.Extensions.DependencyInjectionandMicrosoft.Extensions.Hostingprimitives; nothing replaces or intercepts host behavior. - Broad compatibility. Targets
netstandard2.0throughnet10.0, so it works in both legacy applications (including .NET Framework 4.8, via thenetstandard2.0build) and modern ones. - Trimming/AOT friendly. On .NET 8+, implementation type parameters are annotated with
[DynamicallyAccessedMembers]so trimming preserves the constructors the DI container needs. - Stable public API. The public API surface is locked by snapshot tests
(
PublicApiTests); any accidental breaking change fails the build.
Versioning and support
The package follows semantic versioning (versions are generated by GitVersion). Breaking changes only occur in major releases.
License
MIT — see LICENSE.txt.