Class InMemoryIntentCatalog
- Namespace
- IntentSharp.Catalog
- Assembly
- IntentSharp.Catalog.dll
A catalog held in memory, for tests and for intents defined in code. Definitions are checked with the same rules as files (an invalid one throws ArgumentException listing every problem) and copied, so changing the object afterwards does not change the catalog. Every Add(IntentDefinition), Replace(IntentDefinition) and successful Remove(string) publishes a new snapshot and fires the change token. Thread-safe.
public sealed class InMemoryIntentCatalog : IIntentCatalog
- Inheritance
-
objectInMemoryIntentCatalog
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Constructors
- InMemoryIntentCatalog()
Creates an empty catalog.
- InMemoryIntentCatalog(IEnumerable<IntentDefinition>)
Creates a catalog holding
definitions, each added as by Add(IntentDefinition).
Fields
- DefaultSource
The source recorded for definitions that do not set one.
Properties
- Current
The current snapshot: Empty until the first change, then a new one per change. Its problems are always empty.
Methods
- Add(IntentDefinition)
Adds a definition. Throws when it is invalid or its name is already in the catalog (use Replace(IntentDefinition)).
- GetChangeToken()
A token that fires once, after the next Add(IntentDefinition), Replace(IntentDefinition) or successful Remove(string). Take a new token after it fires.
- ReloadAsync(CancellationToken)
Nothing to read again; returns the current snapshot.
- Remove(string)
Removes the named definition. Returns false (and changes nothing) when there is none.
- Replace(IntentDefinition)
Adds a definition, or replaces the one with the same name. Throws when it is invalid.