HostLoom.Locking.DependencyInjection
0.20.0
dotnet add package HostLoom.Locking.DependencyInjection --version 0.20.0
NuGet\Install-Package HostLoom.Locking.DependencyInjection -Version 0.20.0
<PackageReference Include="HostLoom.Locking.DependencyInjection" Version="0.20.0" />
<PackageVersion Include="HostLoom.Locking.DependencyInjection" Version="0.20.0" />
<PackageReference Include="HostLoom.Locking.DependencyInjection" />
paket add HostLoom.Locking.DependencyInjection --version 0.20.0
#r "nuget: HostLoom.Locking.DependencyInjection, 0.20.0"
#:package HostLoom.Locking.DependencyInjection@0.20.0
#addin nuget:?package=HostLoom.Locking.DependencyInjection&version=0.20.0
#tool nuget:?package=HostLoom.Locking.DependencyInjection&version=0.20.0
HostLoom.Locking.DependencyInjection
This package registers the HostLoom.Locking kernel with
Microsoft.Extensions.DependencyInjection:
services
.AddHostLoomLocking(locking => locking.Namespace = "billing")
.UseInMemory()
.AddHealthChecks();
Pass a profile name to compose independently configured locks and resolve them as keyed services:
services.AddHostLoomLocking("orders", locking => locking.Namespace = "orders").UseInMemory();
services.AddHostLoomLocking("catalog", locking => locking.Namespace = "catalog").UseInMemory();
var orders = provider.GetRequiredKeyedService<IDistributedLock>("orders");
var catalog = provider.GetRequiredKeyedService<IDistributedLock>("catalog");
Each profile has its own named options, provider, and readiness resources. Disabling one profile leaves
the others coordinated, and default health-check names gain a :{profile} suffix. A caller-supplied
health-check name is used as given and must be unique. Service-provider disposal disposes all owned
profiles; profiles do not have independent teardown lifetimes.
Leadership roles, node-ID pools, and exclusive schedules accept a lockProfile argument and use
that exact keyed lock for provider behavior, lease and key-length limits, and uncoordinated policy.
A missing profile fails startup and names its consumer and profile; an enabled default lock does
not override a bound disabled profile.
AddHostLoomLocking binds LockingOptions, validates them when the host starts with messages
that name the option key at fault, and registers IDistributedLock as a singleton composed from
the provider chosen on the builder. It works without AddHostLoom(); nothing here references the
messaging kernel. Repeated calls return a builder over the same registration, and every
registration is TryAdd, so an application can register its own TimeProvider or provider first.
Exactly one provider per profile: UseInMemory() installs the per-process provider, and a backend
package such as HostLoom.Redis adds its own Use* extension over UseProvider<TProvider>(name).
A second Use* on that profile throws and names the provider already chosen. An enabled lock with
no provider fails startup validation; Locking:Enabled = false is single-instance mode and needs
none.
When several features share locking, select the provider once at the composition root. Repeated
AddHostLoomLocking() calls are allowed; calling UseRedis(), UseInMemory(), or another provider
selector again is rejected, even when selecting the same provider. A duplicate selection reports
that locking was configured more than once so conflicting backend settings cannot be silently hidden.
AddHealthChecks() registers a readiness check tagged ready that asks the provider's
ILockProviderHealthProbe whether the backend is reachable. A provider without a probe, including
the in-memory one, reports healthy with a description saying so. Liveness is never touched.
See the HostLoom.Locking package README for the contract, the retry policy, and the lost-lease
semantics.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- HostLoom.Locking (>= 0.20.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HostLoom.Locking.DependencyInjection:
| Package | Downloads |
|---|---|
|
HostLoom.Redis
Redis backend for HostLoom caching, locking, and rate limiting over shared connections and StackExchange.Redis. |
|
|
HostLoom.Valkey
Standalone Valkey backend for HostLoom caching, coordination locks, and token-bucket rate limiting over ValkeyDotNet. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.0 | 55 | 10/31/2026 |
| 0.19.0 | 81 | 10/29/2026 |
| 0.18.0 | 120 | 10/27/2026 |
| 0.17.0 | 155 | 10/25/2026 |
| 0.16.1 | 146 | 10/22/2026 |
| 0.16.0 | 192 | 10/14/2026 |
| 0.15.1 | 138 | 10/12/2026 |
| 0.15.0 | 133 | 10/4/2026 |
| 0.14.0 | 117 | 10/4/2026 |
| 0.13.0 | 113 | 9/28/2026 |
| 0.12.0 | 111 | 9/27/2026 |
| 0.11.0 | 111 | 9/25/2026 |
| 0.10.0 | 116 | 9/22/2026 |
| 0.9.0 | 110 | 9/22/2026 |
| 0.8.0 | 126 | 9/19/2026 |
| 0.7.0 | 121 | 9/17/2026 |
| 0.6.0 | 147 | 9/6/2026 |
| 0.5.0 | 128 | 9/5/2026 |
| 0.4.0 | 129 | 9/3/2026 |