Method AddRuleCompilation
- Namespace
- IntentSharp.Guardrails
- Assembly
- IntentSharp.Guardrails.dll
AddRuleCompilation(IServiceCollection, Action<RuleCompileOptions>?)
Registers a RuleCompileHandler as an IEnvironmentChangeHandler for the client
AddIntentSharp builds, over the store and the manifest that
AddGuardrails(IServiceCollection, IDocumentStore, params string[])
registered, so a target's schema change, or a change of a rule file's intent: text, compiles the rule sets
written for that target into their companions through the client's edit seam. Compilation is opt-in:
AddGuardrails does not register it. The handler knows the kinds, subjects and settings AddGuardrails
declared and those registered in the container.
public static IServiceCollection AddRuleCompilation(this IServiceCollection services, Action<RuleCompileOptions>? configure = null)
Parameters
servicesIServiceCollectionThe service collection.
configureAction<RuleCompileOptions>Sets the compile intent and the role; runs once, now. Null keeps the defaults. The manifest is the one
AddGuardrailsregistered, unless this sets another.
Returns
- IServiceCollection
The service collection.
Remarks
Call AddGuardrails on the same service collection, before or after this call: the client is not built
without it, and its resolution throws an InvalidOperationException that says so. A second call
changes nothing; the options of the first stay.
Exceptions
- ArgumentNullException
servicesis null.- ArgumentException
The compile intent's name cannot name a document.