Table of Contents

Class SilverbackBuilder

Namespace
Silverback.Configuration
Assembly
Silverback.Core.dll

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

public class SilverbackBuilder
Inheritance
SilverbackBuilder
Inherited Members

Constructors

SilverbackBuilder(IServiceCollection)

Initializes a new instance of the SilverbackBuilder class.

public SilverbackBuilder(IServiceCollection services)

Parameters

services IServiceCollection

The IServiceCollection to be wrapped.

Properties

BusOptions

Gets the BusOptions.

public BusOptions BusOptions { get; }

Property Value

BusOptions

Services

Gets the wrapped IServiceCollection.

public IServiceCollection Services { get; }

Property Value

IServiceCollection

Methods

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

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

public SilverbackBuilder AddDelegateSubscriber<TMessage>(Action<TMessage> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Action<TMessage>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage>(Func<TMessage, Task> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, Task>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage>(Func<TMessage, ValueTask> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, ValueTask>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Action<TMessage, T2> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Action<TMessage, T2>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, Task<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, ValueTask<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, Task> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, Task>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2>(Func<TMessage, T2, ValueTask> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, ValueTask>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, TResult>(Func<TMessage, TResult> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, TResult>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Action<TMessage, T2, T3> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Action<TMessage, T2, T3>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, Task<TResult>> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, Task<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, ValueTask<TResult>> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, ValueTask<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, Task> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, T3, Task>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3>(Func<TMessage, T2, T3, ValueTask> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, T3, ValueTask>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, TResult>(Func<TMessage, T2, TResult> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, TResult>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, T4>(Action<TMessage, T2, T3, T4> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Action<TMessage, T2, T3, T4>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, Task<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, ValueTask<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, T4, Task>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, T4, ValueTask>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddDelegateSubscriber<TMessage, T2, T3, TResult>(Func<TMessage, T2, T3, TResult> handler, DelegateSubscriptionOptions? options = null)

Parameters

handler Func<TMessage, T2, T3, TResult>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, T4, Task<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, T4, ValueTask<TResult>>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

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

Parameters

handler Func<TMessage, T2, T3, T4, TResult>

The message handler delegate.

options DelegateSubscriptionOptions

The DelegateSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddScopedBehavior(Func<IServiceProvider, IBehavior> implementationFactory)

Parameters

implementationFactory Func<IServiceProvider, IBehavior>

The factory that creates the service.

Returns

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.

public SilverbackBuilder AddScopedBehavior(Type behaviorType)

Parameters

behaviorType Type

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

Returns

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.

public SilverbackBuilder AddScopedBehavior<TBehavior>() where TBehavior : class, IBehavior

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TBehavior

The type of the behavior to add.

AddScopedSubscriber(Type, TypeSubscriptionOptions)

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

public SilverbackBuilder AddScopedSubscriber(Type subscriberType, TypeSubscriptionOptions options)

Parameters

subscriberType Type

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

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

public SilverbackBuilder AddScopedSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)

Parameters

subscriberType Type

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

autoSubscribeAllPublicMethods bool

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

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

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.

public SilverbackBuilder AddScopedSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class

Parameters

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TSubscriber

The type of the subscriber to add.

AddScopedSubscriber<TSubscriber>(bool)

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

public SilverbackBuilder AddScopedSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddScopedSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TSubscriber

The type of the subscriber to add.

AddSingletonBehavior(IBehavior)

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

public SilverbackBuilder AddSingletonBehavior(IBehavior implementationInstance)

Parameters

implementationInstance IBehavior

The instance of the service.

Returns

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.

public SilverbackBuilder AddSingletonBehavior(Func<IServiceProvider, IBehavior> implementationFactory)

Parameters

implementationFactory Func<IServiceProvider, IBehavior>

The factory that creates the service.

Returns

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.

public SilverbackBuilder AddSingletonBehavior(Type behaviorType)

Parameters

behaviorType Type

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

Returns

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.

public SilverbackBuilder AddSingletonBehavior<TBehavior>() where TBehavior : class, IBehavior

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TBehavior

The type of the behavior to add.

AddSingletonSubscriber(Type, TypeSubscriptionOptions)

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

public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, TypeSubscriptionOptions options)

Parameters

subscriberType Type

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

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)

Parameters

subscriberType Type

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

autoSubscribeAllPublicMethods bool

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

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

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.

public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, object implementationInstance, TypeSubscriptionOptions options)

Parameters

subscriberType Type

The type of the subscriber to register.

implementationInstance object

The instance of the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

public SilverbackBuilder AddSingletonSubscriber(Type subscriberType, object implementationInstance, bool autoSubscribeAllPublicMethods = true)

Parameters

subscriberType Type

The type of the subscriber to register.

implementationInstance object

The instance of the service.

autoSubscribeAllPublicMethods bool

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

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.

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class

Parameters

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TSubscriber

The type of the subscriber to add.

AddSingletonSubscriber<TSubscriber>(bool)

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

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TSubscriber implementationInstance, TypeSubscriptionOptions options) where TSubscriber : class

Parameters

implementationInstance TSubscriber

The instance of the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddSingletonSubscriber<TSubscriber>(TSubscriber implementationInstance, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

implementationInstance TSubscriber

The instance of the service.

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddTransientBehavior(Func<IServiceProvider, IBehavior> implementationFactory)

Parameters

implementationFactory Func<IServiceProvider, IBehavior>

The factory that creates the service.

Returns

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.

public SilverbackBuilder AddTransientBehavior(Type behaviorType)

Parameters

behaviorType Type

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

Returns

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.

public SilverbackBuilder AddTransientBehavior<TBehavior>() where TBehavior : class, IBehavior

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TBehavior

The type of the behavior to add.

AddTransientSubscriber(Type, TypeSubscriptionOptions)

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

public SilverbackBuilder AddTransientSubscriber(Type subscriberType, TypeSubscriptionOptions options)

Parameters

subscriberType Type

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

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

public SilverbackBuilder AddTransientSubscriber(Type subscriberType, bool autoSubscribeAllPublicMethods = true)

Parameters

subscriberType Type

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

autoSubscribeAllPublicMethods bool

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

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

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.

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

Parameters

subscriberType Type

The type of the subscriber to register.

implementationFactory Func<IServiceProvider, object>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

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.

public SilverbackBuilder AddTransientSubscriber<TSubscriber>(TypeSubscriptionOptions options) where TSubscriber : class

Parameters

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TSubscriber

The type of the subscriber to add.

AddTransientSubscriber<TSubscriber>(bool)

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

public SilverbackBuilder AddTransientSubscriber<TSubscriber>(bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, TypeSubscriptionOptions options) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

options TypeSubscriptionOptions

The TypeSubscriptionOptions.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder AddTransientSubscriber<TSubscriber>(Func<IServiceProvider, TSubscriber> implementationFactory, bool autoSubscribeAllPublicMethods = true) where TSubscriber : class

Parameters

implementationFactory Func<IServiceProvider, TSubscriber>

The factory that creates the service.

autoSubscribeAllPublicMethods bool

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

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

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.

public SilverbackBuilder HandleMessagesOfType(Type messageType)

Parameters

messageType Type

The (base) message type.

Returns

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.

public SilverbackBuilder HandleMessagesOfType<TMessage>()

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.

Type Parameters

TMessage

The (base) message type.

WithLogLevels(Action<LogLevelConfigurator>)

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

public SilverbackBuilder WithLogLevels(Action<LogLevelConfigurator> logLevelsConfigurationAction)

Parameters

logLevelsConfigurationAction Action<LogLevelConfigurator>

The log levels configuration action.

Returns

SilverbackBuilder

The SilverbackBuilder so that additional calls can be chained.