Documentation
Table of Contents

Method WithRuleCompilation

Namespace
IntentSharp.Guardrails
Assembly
IntentSharp.Guardrails.dll

WithRuleCompilation(IntentClientBuilder, IDocumentStore, Action<RuleCompileOptions>?)

Adds a RuleCompileHandler over store to the client's environment change handlers, 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: WithGuardrailFiles(IntentClientBuilder, IDocumentStore, params string[]) does not add it. The client must use the same store (WithDocumentStore(IDocumentStore)), since the companion is submitted as an edit of the client's store, and must validate rule documents with a RuleDocumentValidator, which WithGuardrailFiles adds: a companion no validator handles is refused by the edit seam, and the version that ran before keeps running.

public static IntentClientBuilder WithRuleCompilation(this IntentClientBuilder builder, IDocumentStore store, Action<RuleCompileOptions>? configure = null)

Parameters

builder IntentClientBuilder

The builder.

store IDocumentStore

The store that holds the manifest, the rule files and their companions.

configure Action<RuleCompileOptions>

Sets the compile intent, the role and the manifest; runs once, now. Null keeps the defaults.

Returns

IntentClientBuilder

The builder.

Exceptions

ArgumentNullException

builder or store is null.

ArgumentException

The compile intent's name cannot name a document.