Show / Hide Table of Contents

    Class SilverbackBuilder

    Exposes the methods to configure Silverback and enable its optional features adding the necessary services to the IServiceCollection.

    Inheritance
    object
    SilverbackBuilder
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Silverback.Configuration
    Assembly: Silverback.Core.dll
    Syntax
    public class SilverbackBuilder

    Constructors

    SilverbackBuilder(IServiceCollection)

    Initializes a new instance of the SilverbackBuilder class.

    Declaration
    public SilverbackBuilder(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services

    The IServiceCollection to be wrapped.

    Properties

    BusOptions

    Gets the BusOptions.

    Declaration
    public BusOptions BusOptions { get; }
    Property Value
    Type Description
    BusOptions

    Services

    Gets the wrapped IServiceCollection.

    Declaration
    public IServiceCollection Services { get; }
    Property Value
    Type Description
    IServiceCollection

    Methods

    AddDelegateSubscriber<TMessage>(Action<TMessage>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage>(Action<TMessage> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Action<TMessage> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    AddDelegateSubscriber<TMessage>(Func<TMessage, Task>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage>(Func<TMessage, Task> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, Task> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    AddDelegateSubscriber<TMessage>(Func<TMessage, ValueTask>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage>(Func<TMessage, ValueTask> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, ValueTask> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    AddDelegateSubscriber<TMessage, T2>(Action<TMessage, T2>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Action<TMessage, T2> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Action<TMessage, T2> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, Task<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, Task<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, ValueTask<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, ValueTask<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, Task>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, Task> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, Task> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, ValueTask>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, ValueTask> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, ValueTask> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, TResult>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, TResult> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, TResult> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3>(Action<TMessage, T2, T3>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Action<TMessage, T2, T3> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Action<TMessage, T2, T3> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, Task<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, Task<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, ValueTask<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, ValueTask<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, Task>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, Task> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, Task> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, ValueTask>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, ValueTask> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, ValueTask> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, TResult>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, TResult> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, TResult> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, T4>(Action<TMessage, T2, T3, T4>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4>(Action<TMessage, T2, T3, T4> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Action<TMessage, T2, T3, T4> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, Task<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, Task<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, ValueTask<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, ValueTask<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, T4>(Func<TMessage, T2, T3, T4, Task>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4>(Func<TMessage, T2, T3, T4, Task> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, T4, Task> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, T3, T4>(Func<TMessage, T2, T3, T4, ValueTask>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4>(Func<TMessage, T2, T3, T4, ValueTask> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, T4, ValueTask> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, TResult>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, TResult> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, TResult> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, Task<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, T4, Task<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, ValueTask<TResult>>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, T4, ValueTask<TResult>> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, TResult>, DelegateSubscriptionOptions?)

    Subscribes the specified delegate to the messages being published into the bus.

    Declaration
    public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4, TResult>(Func<TMessage, T2, T3, T4, TResult> handler, DelegateSubscriptionOptions? options = null)
    Parameters
    Type Name Description
    Func<TMessage, T2, T3, T4, TResult> handler

    The message handler delegate.

    DelegateSubscriptionOptions options

    The DelegateSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The type of the messages to be handled.

    T2

    The type of an additional service to be resolved and passed to the method.

    T3

    The type of an additional service to be resolved and passed to the method.

    T4

    The type of an additional service to be resolved and passed to the method.

    TResult

    The type of the result returned by the handler.

    AddScopedBehavior(Func<IServiceProvider, IBehavior>)

    Adds a scoped behavior with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedBehavior(Func<IServiceProvider, IBehavior> implementationFactory)
    Parameters
    Type Name Description
    Func<IServiceProvider, IBehavior> implementationFactory

    The factory that creates the service.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedBehavior(Type)

    Adds a scoped behavior of the type specified in behaviorType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedBehavior(Type behaviorType)
    Parameters
    Type Name Description
    Type behaviorType

    The type of the behavior to register and the implementation to use.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedBehavior<TBehavior>()

    Adds a scoped behavior of the type specified in TBehavior to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedBehavior<TBehavior>() where TBehavior : class, IBehavior
    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TBehavior

    The type of the behavior to add.

    AddScopedSubscriber(Type, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber(Type subscriberType, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedSubscriber(Type, bool)

    Adds a scoped subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedSubscriber(Type, Func<IServiceProvider, object>, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedSubscriber(Type, Func<IServiceProvider, object>, bool)

    Adds a scoped subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddScopedSubscriber<TSubscriber>(TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in TSubscriber to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddScopedSubscriber<TSubscriber>(bool)

    Adds a scoped subscriber of the type specified in TSubscriber to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, bool)

    Adds a scoped subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddSingletonBehavior(IBehavior)

    Adds a singleton behavior with an instance specified in implementationInstance to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonBehavior(IBehavior implementationInstance)
    Parameters
    Type Name Description
    IBehavior implementationInstance

    The instance of the service.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonBehavior(Func<IServiceProvider, IBehavior>)

    Adds a singleton behavior with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonBehavior(Func<IServiceProvider, IBehavior> implementationFactory)
    Parameters
    Type Name Description
    Func<IServiceProvider, IBehavior> implementationFactory

    The factory that creates the service.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonBehavior(Type)

    Adds a singleton behavior of the type specified in behaviorType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonBehavior(Type behaviorType)
    Parameters
    Type Name Description
    Type behaviorType

    The type of the behavior to register and the implementation to use.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonBehavior<TBehavior>()

    Adds a singleton behavior of the type specified in TBehavior to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonBehavior<TBehavior>() where TBehavior : class, IBehavior
    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TBehavior

    The type of the behavior to add.

    AddSingletonSubscriber(Type, TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber(Type, bool)

    Adds a singleton subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber(Type, Func<IServiceProvider, object>, TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber(Type, Func<IServiceProvider, object>, bool)

    Adds a singleton subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber(Type, object, TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in subscriberType with an instance specified in implementationInstance to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, object implementationInstance, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    object implementationInstance

    The instance of the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber(Type, object, bool)

    Adds a singleton subscriber of the type specified in subscriberType with an instance specified in implementationInstance to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, object implementationInstance, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    object implementationInstance

    The instance of the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddSingletonSubscriber<TSubscriber>(TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in TSubscriber to this SilverbackBuilder.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddSingletonSubscriber<TSubscriber>(bool)

    Adds a singleton subscriber of the type specified in TSubscriber to this SilverbackBuilder.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, bool)

    Adds a singleton subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddSingletonSubscriber<TSubscriber>(TSubscriber, TypeSubscriptionOptions)

    Adds a singleton subscriber of the type specified in TSubscriber with an instance specified in implementationInstance to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TSubscriber implementationInstance, TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    TSubscriber implementationInstance

    The instance of the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to register.

    AddSingletonSubscriber<TSubscriber>(TSubscriber, bool)

    Adds a singleton subscriber of the type specified in TSubscriber with an instance specified in implementationInstance to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TSubscriber implementationInstance, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    TSubscriber implementationInstance

    The instance of the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to register.

    AddTransientBehavior(Func<IServiceProvider, IBehavior>)

    Adds a scoped behavior with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientBehavior(Func<IServiceProvider, IBehavior> implementationFactory)
    Parameters
    Type Name Description
    Func<IServiceProvider, IBehavior> implementationFactory

    The factory that creates the service.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientBehavior(Type)

    Adds a scoped behavior of the type specified in behaviorType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientBehavior(Type behaviorType)
    Parameters
    Type Name Description
    Type behaviorType

    The type of the behavior to register and the implementation to use.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientBehavior<TBehavior>()

    Adds a scoped behavior of the type specified in TBehavior to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientBehavior<TBehavior>() where TBehavior : class, IBehavior
    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TBehavior

    The type of the behavior to add.

    AddTransientSubscriber(Type, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber(Type subscriberType, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientSubscriber(Type, bool)

    Adds a scoped subscriber of the type specified in subscriberType to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register and the implementation to use.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientSubscriber(Type, Func<IServiceProvider, object>, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, TypeSubscriptionOptions options)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientSubscriber(Type, Func<IServiceProvider, object>, bool)

    Adds a scoped subscriber of the type specified in subscriberType with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber(Type subscriberType, Func<IServiceProvider, object> implementationFactory, bool autoSubscribeAllPublicMethods = true)
    Parameters
    Type Name Description
    Type subscriberType

    The type of the subscriber to register.

    Func<IServiceProvider, object> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    AddTransientSubscriber<TSubscriber>(TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in TSubscriber to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddTransientSubscriber<TSubscriber>(bool)

    Adds a scoped subscriber of the type specified in TSubscriber to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, TypeSubscriptionOptions)

    Adds a scoped subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    TypeSubscriptionOptions options

    The TypeSubscriptionOptions.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber>, bool)

    Adds a scoped subscriber of the type specified in TSubscriber with a factory specified in implementationFactory to the IServiceCollection.

    Declaration
    public SilverbackBuilder AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class
    Parameters
    Type Name Description
    Func<IServiceProvider, TSubscriber> implementationFactory

    The factory that creates the service.

    bool autoSubscribeAllPublicMethods

    A boolean value indicating whether all public methods of the specified type have to be automatically subscribed. When set to false only the methods decorated with the SubscribeAttribute are subscribed.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TSubscriber

    The type of the subscriber to add.

    HandleMessagesOfType(Type)

    Configures the specified type to be recognized as a message to enable features like automatic republishing.

    Declaration
    public SilverbackBuilder HandleMessagesOfType(Type messageType)
    Parameters
    Type Name Description
    Type messageType

    The (base) message type.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    HandleMessagesOfType<TMessage>()

    Configures the type TMessage to be recognized as a message to enable features like automatic republishing.

    Declaration
    public SilverbackBuilder HandleMessagesOfType<TMessage>()
    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    Type Parameters
    Name Description
    TMessage

    The (base) message type.

    WithLogLevels(Action<LogLevelConfigurator>)

    Configures the log levels that should be used to log the standard Silverback events.

    Declaration
    public SilverbackBuilder WithLogLevels(Action<LogLevelConfigurator> logLevelsConfigurationAction)
    Parameters
    Type Name Description
    Action<LogLevelConfigurator> logLevelsConfigurationAction

    The log levels configuration action.

    Returns
    Type Description
    SilverbackBuilder

    The SilverbackBuilder so that additional calls can be chained.

    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini