Skip to content

Class RestBehaviorModuleBase

Namespace: Cephalon.Behaviors.Http.Hosting
Assembly: Cephalon.Behaviors.Http.dll

Base class for modules that own behaviors and expose a public REST surface for some of them.

public abstract class RestBehaviorModuleBase : BehaviorModuleBase, IModuleLifecycle, IBehaviorOwnerModule, IRestModule, IModule

object ← ModuleBase ← BehaviorModuleBase ← RestBehaviorModuleBase

IModuleLifecycle, IBehaviorOwnerModule, IRestModule, IModule

BehaviorModuleBase.ConfigureBehaviors(IBehaviorModuleBuilder), ModuleBase.Descriptor, ModuleBase.ConfigureServices(IServiceCollection), ModuleBase.RegisterCapabilities(ICapabilityRegistry), ModuleBase.InitializeAsync(ModuleContext, CancellationToken), ModuleBase.StartAsync(ModuleContext, CancellationToken), ModuleBase.StopAsync(ModuleContext, CancellationToken), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

This base class keeps behavior ownership host-agnostic through while moving the common REST authoring path into a single REST-focused DSL. Behaviors mapped through are owned by the module automatically, which removes the need to declare the same public behavior in both ConfigureBehaviors(...) and MapEndpoints(...).

Use instead when a module owns behaviors but does not expose a public REST surface. Use only for advanced/custom Minimal API work that falls outside the default REST behavior DSL.

ConfigureBehaviors(IBehaviorModuleBuilder)

Section titled “ ConfigureBehaviors(IBehaviorModuleBuilder)”

Registers the behaviors owned by the current module.

public override sealed void ConfigureBehaviors(IBehaviorModuleBuilder behaviors)

behaviors IBehaviorModuleBuilder

The module-owned behavior builder.

ConfigureRestBehaviors(IRestBehaviorModuleBuilder)

Section titled “ ConfigureRestBehaviors(IRestBehaviorModuleBuilder)”

Declares the module-owned behaviors and their public REST surface in one place.

public abstract void ConfigureRestBehaviors(IRestBehaviorModuleBuilder behaviors)

behaviors IRestBehaviorModuleBuilder

The REST behavior-module builder.

Configures services required by the module.

public override void ConfigureServices(IServiceCollection services)

services IServiceCollection

The service collection receiving module services.

Gets the marker type used to resolve generated REST profile metadata for the current module.

protected virtual Type GetRestBehaviorProfileSourceType()

Type

The marker type whose assembly Cephalon should treat as the source for generated REST profile hints when MapGeneratedProfiles(…) or MapGeneratedProfileGroups(…) is used.

Most modules should use the default implementation, which points at the concrete module type itself. Low-code wrappers can override this to point at a stable marker type from the behavior assembly when the module instance is implemented by a reusable helper type.

MapAdditionalEndpoints(IEndpointRouteBuilder)

Section titled “ MapAdditionalEndpoints(IEndpointRouteBuilder)”

Adds any advanced/manual Minimal API endpoints that are not covered by the default REST behavior DSL.

protected virtual void MapAdditionalEndpoints(IEndpointRouteBuilder endpoints)

endpoints IEndpointRouteBuilder

The endpoint route builder receiving additional module endpoints.

When a custom endpoint still dispatches into a Cephalon behavior, declare ownership first through using Internal<TBehavior>() so engine composition remains deterministic.