Documentation
Table of Contents

Class CatalogServiceCollectionExtensions

Namespace
IntentSharp.Catalog
Assembly
IntentSharp.Catalog.dll

Registers the intent catalog and runtime:

services.AddIntentSharp(configuration);
services.AddIntentCatalog("intents");
services.AddIntentRuntime();
services.AddIntentValidator("KnownSku", value => ...);
services.AddIntentType<Invoice>();

Every registration is a singleton. The validator and type registries start empty and are filled from the AddIntentValidator and AddIntentType calls (in any order relative to AddIntentRuntime) when first resolved.

public static class CatalogServiceCollectionExtensions
Inheritance
object
CatalogServiceCollectionExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

Methods

AddIntentCatalog(IServiceCollection, string, Action<FileIntentCatalogOptions>?)

Registers a FileIntentCatalog over folder (relative paths resolve against BaseDirectory) as IIntentCatalog. It loads when first resolved, watches the folder, and is disposed with the container. The first registration wins.

AddIntentRuntime(IServiceCollection)

Registers IntentRuntime (needs an IntentClient and an IIntentCatalog) and the validator and type registries. Registries already registered by the caller are kept.

AddIntentType(IServiceCollection, string, Type)

Allows definitions to name type in shape.clrType by the alias name.

AddIntentType(IServiceCollection, Type)

Allows definitions to name type in shape.clrType (by simple, full or assembly-qualified name).

AddIntentType<T>(IServiceCollection)

Allows definitions to name T in shape.clrType (by simple, full or assembly-qualified name).

AddIntentValidator(IServiceCollection, string, Func<object?, IEnumerable<string>>)

Adds a named code validator that definitions can list in validators.

AddIntentValidator<T>(IServiceCollection, string, Func<T, IEnumerable<string>>)

Adds a typed named code validator; a result of another type is reported as a problem.