Documentation
Table of Contents

Property OnBuild

Namespace
IntentSharp.Guardrails
Assembly
IntentSharp.dll

OnBuild

Called by Build() with the settings and subjects declared on the builder with AddSetting(SettingDescriptor) and AddSubject(SubjectDescriptor), whatever the order of those calls and WithGuardrails(GuardrailOptions). The options it returns are the ones the client is built with, and their own OnBuild is not called. It lets a source that reads rule files learn the builder's declarations, as the Guardrails package's WithGuardrailFiles does. Null, the default, builds the client with these options as they are.

public Func<GuardrailDeclarations, GuardrailOptions>? OnBuild { get; init; }

Property Value

Func<GuardrailDeclarations, GuardrailOptions>

Remarks

The builder's declarations reach the client in any case, so the returned options need not repeat them; when they do, in Settings or Subjects, each must be the same descriptor (the same object, or one equal in every property), which is then counted once. It is called on each build, so a builder built twice calls it twice. Returning null makes Build() throw InvalidOperationException.