Skip to content

Class BehaviorSourceGenerator

Namespace: Cephalon.Behaviors.SourceGen
Assembly: Cephalon.Behaviors.SourceGen.dll

Incremental source generator that validates classes decorated with [AppBehavior], emits compile-time diagnostics for common authoring mistakes, and generates zero-reflection registration code with pre-built topology descriptors. Diagnostic IDs: ABT-010 through ABT-026.

[Generator]
public sealed class BehaviorSourceGenerator : IIncrementalGenerator

objectBehaviorSourceGenerator

IIncrementalGenerator

object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()

ABT-010: Class with [AppBehavior] must implement IAppBehavior<TIn, TOut>.

public static readonly DiagnosticDescriptor Abt010MustImplementIAppBehavior

DiagnosticDescriptor

ABT-011: [AppBehavior] id must not be empty or whitespace.

public static readonly DiagnosticDescriptor Abt011EmptyBehaviorId

DiagnosticDescriptor

ABT-012: [AppBehavior] class must not be abstract.

public static readonly DiagnosticDescriptor Abt012MustNotBeAbstract

DiagnosticDescriptor

ABT-013: [AppBehavior] class must not be static.

public static readonly DiagnosticDescriptor Abt013MustNotBeStatic

DiagnosticDescriptor

ABT-014: REST is module-owned only and must not be declared in behavior topology.

public static readonly DiagnosticDescriptor Abt014RestMustBeModuleOwned

DiagnosticDescriptor

ABT-015: [BehaviorRestProfile] must select a supported REST method.

public static readonly DiagnosticDescriptor Abt015RestProfileMethodMustBeSpecified

DiagnosticDescriptor

ABT-016: [BehaviorRestProfile] relative pattern must not be empty.

public static readonly DiagnosticDescriptor Abt016RestProfilePatternMustNotBeEmpty

DiagnosticDescriptor

ABT-017: [BehaviorRestProfile] API version must be positive when specified.

public static readonly DiagnosticDescriptor Abt017RestProfileVersionMustBePositive

DiagnosticDescriptor

Abt018RestProfilePatternMustStartWithSlash

Section titled “ Abt018RestProfilePatternMustStartWithSlash”

ABT-018: [BehaviorRestProfile] relative pattern must start with ’/’.

public static readonly DiagnosticDescriptor Abt018RestProfilePatternMustStartWithSlash

DiagnosticDescriptor

Abt019RestBindingPropertyNameMustNotBeEmpty

Section titled “ Abt019RestBindingPropertyNameMustNotBeEmpty”

ABT-019: [BehaviorRestBinding] target property name must not be empty.

public static readonly DiagnosticDescriptor Abt019RestBindingPropertyNameMustNotBeEmpty

DiagnosticDescriptor

ABT-020: [BehaviorRestBinding] source must select a supported binding source.

public static readonly DiagnosticDescriptor Abt020RestBindingSourceMustBeSupported

DiagnosticDescriptor

ABT-021: Explicit REST bindings require an object input with public properties.

public static readonly DiagnosticDescriptor Abt021RestBindingsRequireObjectInput

DiagnosticDescriptor

Abt022RestBindingPropertyMustExistOnInput

Section titled “ Abt022RestBindingPropertyMustExistOnInput”

ABT-022: [BehaviorRestBinding] property must exist on the behavior input.

public static readonly DiagnosticDescriptor Abt022RestBindingPropertyMustExistOnInput

DiagnosticDescriptor

Abt023RestBindingPropertyMustNotBeDuplicated

Section titled “ Abt023RestBindingPropertyMustNotBeDuplicated”

ABT-023: [BehaviorRestBinding] must not target the same property twice.

public static readonly DiagnosticDescriptor Abt023RestBindingPropertyMustNotBeDuplicated

DiagnosticDescriptor

Abt024RestBodyBindingMustUseBodyCapableMethod

Section titled “ Abt024RestBodyBindingMustUseBodyCapableMethod”

ABT-024: GET/DELETE REST profiles must not bind from the request body.

public static readonly DiagnosticDescriptor Abt024RestBodyBindingMustUseBodyCapableMethod

DiagnosticDescriptor

Abt025RestRouteBindingMustMatchRoutePlaceholder

Section titled “ Abt025RestRouteBindingMustMatchRoutePlaceholder”

ABT-025: Route bindings must target placeholders declared in the profile pattern.

public static readonly DiagnosticDescriptor Abt025RestRouteBindingMustMatchRoutePlaceholder

DiagnosticDescriptor

Abt026RestProfilePatternMustUseValidPlaceholderSyntax

Section titled “ Abt026RestProfilePatternMustUseValidPlaceholderSyntax”

ABT-026: REST profile patterns must use valid route placeholder syntax.

public static readonly DiagnosticDescriptor Abt026RestProfilePatternMustUseValidPlaceholderSyntax

DiagnosticDescriptor

Abt027RestPreservedImplicitQueryFallbackRequiresExplicitBindings

Section titled “ Abt027RestPreservedImplicitQueryFallbackRequiresExplicitBindings”

ABT-027: Preserved implicit query fallback requires at least one explicit binding.

public static readonly DiagnosticDescriptor Abt027RestPreservedImplicitQueryFallbackRequiresExplicitBindings

DiagnosticDescriptor

Initialize(IncrementalGeneratorInitializationContext)

Section titled “ Initialize(IncrementalGeneratorInitializationContext)”

Called to initialize the generator and register generation steps via callbacks on the context

public void Initialize(IncrementalGeneratorInitializationContext context)

context IncrementalGeneratorInitializationContext

The to register callbacks on