Table of Contents

SavvyioOptionsExtensions Class

Definition

Namespace
Savvyio.Extensions
Assemblies
Savvyio.Extensions.Dispatchers.dll
Source
src/Savvyio.Extensions.Dispatchers/SavvyioOptionsExtensions.cs

Extension methods for the SavvyioOptions class.

public static class SavvyioOptionsExtensions
Inheritance
object
SavvyioOptionsExtensions

Examples

SavvyioOptionsExtensions adds AddMediator<TImplementation> and the discovery switches UseAutomaticDispatcherDiscovery and UseAutomaticHandlerDiscovery to SavvyioOptions. Chain them to configure the framework for automatic assembly scanning.

using System;
using Savvyio;
using Savvyio.Extensions;

namespace ExampleApp;

public sealed class SavvyioOptionsConfiguration
{
    public void Configure()
    {
        var options = new SavvyioOptions()
            .AddMediator<Mediator>()
            .UseAutomaticDispatcherDiscovery()
            .UseAutomaticHandlerDiscovery();

        Console.WriteLine($"HandlerDiscovery: {options.AllowHandlerDiscovery}, DispatcherDiscovery: {options.AllowDispatcherDiscovery}");
    }
}

Methods

Name Description
AddMediator<TImplementation>(SavvyioOptions)

Adds an implementation of the IMediator interface.

UseAutomaticDispatcherDiscovery(SavvyioOptions, bool)

Enforce automatic discovery of handlers implementing the IDispatcher interface using either bruteAssemblyScanning or lightweight GetCallingAssembly().

UseAutomaticHandlerDiscovery(SavvyioOptions, bool)

Enforce automatic discovery of dispatchers implementing the IHandler interface using either bruteAssemblyScanning or lightweight GetCallingAssembly().