Table of Contents

Class GenerateDispatcherAttribute

Namespace
PatternKit.Generators.Messaging
Assembly
PatternKit.Generators.Abstractions.dll

Marks an assembly for source-generated Mediator pattern implementation.

The Mediator pattern reduces coupling between components by centralizing communication through a mediator object. This source generator produces a standalone mediator with zero PatternKit runtime dependencies.

The generated mediator supports:

  • Commands (request → response)
  • Notifications (fan-out to multiple handlers)
  • Streams (async enumerable results)
  • Pipelines (pre/post hooks for cross-cutting concerns)
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class GenerateDispatcherAttribute : Attribute
Inheritance
GenerateDispatcherAttribute
Inherited Members

Properties

IncludeObjectOverloads

Gets or sets whether to include object-based overloads (Send(object), Stream(object), etc.). Default is false for type safety.

public bool IncludeObjectOverloads { get; set; }

Property Value

bool

IncludeStreaming

Gets or sets whether to include streaming support. Default is true.

public bool IncludeStreaming { get; set; }

Property Value

bool

Name

Gets or sets the name of the generated dispatcher class.

public string? Name { get; set; }

Property Value

string

Namespace

Gets or sets the namespace for the generated dispatcher.

public string? Namespace { get; set; }

Property Value

string

Visibility

Gets or sets the visibility of the generated dispatcher. Default is public.

public GeneratedVisibility Visibility { get; set; }

Property Value

GeneratedVisibility