OKF4net.Catalog.Hosting
0.2.0
dotnet add package OKF4net.Catalog.Hosting --version 0.2.0
NuGet\Install-Package OKF4net.Catalog.Hosting -Version 0.2.0
<PackageReference Include="OKF4net.Catalog.Hosting" Version="0.2.0" />
<PackageVersion Include="OKF4net.Catalog.Hosting" Version="0.2.0" />
<PackageReference Include="OKF4net.Catalog.Hosting" />
paket add OKF4net.Catalog.Hosting --version 0.2.0
#r "nuget: OKF4net.Catalog.Hosting, 0.2.0"
#:package OKF4net.Catalog.Hosting@0.2.0
#addin nuget:?package=OKF4net.Catalog.Hosting&version=0.2.0
#tool nuget:?package=OKF4net.Catalog.Hosting&version=0.2.0
OKF4net.Catalog.Hosting
Microsoft.Extensions.DependencyInjection integration for the
OKF4net.Catalog local
knowledge catalog: one extension method, services.AddKnowledge(...), wires
a catalog.json manifest into your host's IServiceCollection.
This package depends on Microsoft.Extensions.DependencyInjection.Abstractions
only — the one explicit exception to OKF4net's zero-dependency policy,
scoped narrowly to DI abstractions (see the project README
for the full dependency policy).
Quick start
using OKF4net.Catalog;
using OKF4net.Catalog.Hosting;
services.AddKnowledge(o => o.AddCatalogFile("./config/catalog.json"));
This registers, all as singletons:
IKnowledgeCatalog— aFileKnowledgeCatalogover the given manifest.IKnowledgeResolver— aDefaultKnowledgeResolverover that catalog.KnowledgeCatalogOptions— the resolved catalog file path and catalog root (derived from the manifest file's own directory), for callers that want to inspect them directly.
Then resolve and use it anywhere in your host:
public sealed class SearchEndpoint(IKnowledgeResolver resolver)
{
public async Task<KnowledgeContext> HandleAsync(string query, CancellationToken ct)
=> await resolver.SearchAsync(new KnowledgeQuery(query), ct);
}
Registration is lazy: no catalog file is read inside AddKnowledge
itself. configure runs immediately and its result is validated at
registration time (an ArgumentException/InvalidOperationException from a
missing or duplicate AddCatalogFile call surfaces right away), but the
catalog.json file itself is only parsed and path-validated the first time
IKnowledgeCatalog (or IKnowledgeResolver) is actually resolved from the
container — an invalid manifest surfaces as CatalogException from that
first resolve, not from AddKnowledge.
V1 limits
- Exactly one catalog per
AddKnowledgecall, and exactly one call wins.AddKnowledgesupports a singleAddCatalogFilecall in itsconfigurecallback in V1 — a secondAddCatalogFilecall inside the sameconfigurecallback throwsInvalidOperationException(AddBundle/ multi-catalog composition is cut as YAGNI; put every source in onecatalog.jsoninstead). - A second, separate
AddKnowledge(...)call on the sameIServiceCollectionis silently ignored — the first one wins. The registrations useTryAddSingleton, so callingAddKnowledgemore than once (e.g. once from your app and once from a library extension method) does not throw and does not error: whichever call ran first determines the catalog that ends up registered, and the second call'sconfigureis still invoked and validated, but its registrations are dropped as no-ops. If you need more than one independently-configured catalog in the same process, registerIKnowledgeCatalog/IKnowledgeResolvermanually under distinct keys instead of relying onAddKnowledgetwice.
See the OKF4net.Catalog README for the catalog model itself (manifest shape, hot-reload behavior, search semantics), and the project README for full documentation.
Licensed LGPL-3.0-or-later.
| 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- OKF4net.Catalog (>= 0.2.0)
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 |
|---|---|---|
| 0.2.0 | 0 | 7/27/2026 |