Skip to content

Class BehaviorCollectionBuilder

Namespace: Cephalon.Behaviors.Services
Assembly: Cephalon.Behaviors.dll

Default implementation of . Registers behavior types in DI, populates the type registry, and optionally contributes a fluent topology descriptor at Layer 4.

public sealed class BehaviorCollectionBuilder : IBehaviorCollectionBuilder

objectBehaviorCollectionBuilder

IBehaviorCollectionBuilder

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

PatternBehaviorExtensions.AddBehaviorPatterns(IBehaviorCollectionBuilder), MessagingBehaviorBindingServiceCollectionExtensions.AddMessagingBehaviorBindings(IBehaviorCollectionBuilder, IConfiguration), MessagingBehaviorBindingServiceCollectionExtensions.AddMessagingBehaviorBindings(IBehaviorCollectionBuilder), MessagingBehaviorBindingServiceCollectionExtensions.AddMessagingBehaviorBindings(IBehaviorCollectionBuilder, Action<InMemoryTransportOptions>?, Action<RabbitMqTransportOptions>?, Action<KafkaTransportOptions>?)

BehaviorCollectionBuilder(IServiceCollection, BehaviorTypeRegistry)

Section titled “ BehaviorCollectionBuilder(IServiceCollection, BehaviorTypeRegistry)”

Initializes the builder with the target service collection and shared type registry.

public BehaviorCollectionBuilder(IServiceCollection services, BehaviorTypeRegistry typeRegistry)

services IServiceCollection

The service collection to register behaviors into.

typeRegistry BehaviorTypeRegistry

The type registry to populate with behavior id-to-type mappings.

Gets the underlying so that transport packs and other extensions can register their own services.

public IServiceCollection Services { get; }

IServiceCollection

Register<TBehavior>(Action<BehaviorTopologyBuilder>?)

Section titled “ Register<TBehavior>(Action<BehaviorTopologyBuilder>?)”

Registers a behavior of type TBehavior with the runtime.

  1. Resolves the behavior id from .
  2. Registers TBehavior as a transient service in DI.
  3. Records the id-to-type mapping in the shared .
  4. When configureTopology is provided, adds a at Layer 4.
public IBehaviorCollectionBuilder Register<TBehavior>(Action<BehaviorTopologyBuilder>? configureTopology = null) where TBehavior : class

configureTopology Action<BehaviorTopologyBuilder>?

An optional callback that configures the behavior’s transport topology at Layer 4 (highest priority). When null, topology is resolved from configuration layers only.

IBehaviorCollectionBuilder

The same builder for fluent chaining.

TBehavior

The concrete behavior type. Must be decorated with and implement .

InvalidOperationException

Thrown when TBehavior is not decorated with .