Table of Contents

Class SavvyioOptions

Namespace
Savvyio
Assembly
Savvyio.Core.dll

Specifies options that is related to setting up Savvy I/O services.

public class SavvyioOptions : IParameterObject
Inheritance
Object
SavvyioOptions
Implements
Extension Methods

Constructors

SavvyioOptions()

Initializes a new instance of the SavvyioOptions class.

public SavvyioOptions()

Remarks

The following table shows the initial property values for an instance of SavvyioOptions.

PropertyInitial Value
AllowDispatcherDiscoveryfalse
AllowHandlerDiscoveryfalse
IncludeHandlerServicesDescriptorfalse

Properties

AllowDispatcherDiscovery

Gets a value indicating whether discovery of IDispatcher implementations using assembly scanning is enabled.

public bool AllowDispatcherDiscovery { get; }

Property Value

Boolean

true discovery of IDispatcher implementations using assembly scanning is enabled; otherwise, false.

AllowHandlerDiscovery

Gets a value indicating whether discovery of IHandler implementations using assembly scanning is enabled.

public bool AllowHandlerDiscovery { get; }

Property Value

Boolean

true discovery of IHandler implementations using assembly scanning is enabled; otherwise, false.

DispatcherImplementationTypes

Gets the types implementing an IDispatcher service.

public IReadOnlyCollection<Type> DispatcherImplementationTypes { get; }

Property Value

IReadOnlyCollection<Type>

The types implementing an IDispatcher service.

DispatcherServiceTypes

Gets the types associated with an IDispatcher service.

public IReadOnlyCollection<Type> DispatcherServiceTypes { get; }

Property Value

IReadOnlyCollection<Type>

The types dispatcher with an IDispatcher service.

HandlerImplementationTypes

Gets the types implementing an IHandler service.

public IReadOnlyCollection<Type> HandlerImplementationTypes { get; }

Property Value

IReadOnlyCollection<Type>

The types implementing an IHandler service.

HandlerServiceTypes

Gets the types associated with an IHandler service.

public IReadOnlyCollection<Type> HandlerServiceTypes { get; }

Property Value

IReadOnlyCollection<Type>

The types associated with an IHandler service.

IncludeHandlerServicesDescriptor

Gets a value indicating whether the HandlerServicesDescriptor is enabled.

public bool IncludeHandlerServicesDescriptor { get; }

Property Value

Boolean

true if the HandlerServicesDescriptor is enabled; otherwise, false.

Methods

AddDispatcher(Type, Type)

Adds a dispatcher of type IDispatcher to DispatcherServiceTypes (if not already registered) and DispatcherImplementationTypes (if not already registered).

public SavvyioOptions AddDispatcher(Type service, Type implementation)

Parameters

service Type

The System.Type of the IDispatcher interface to add.

implementation Type

The type of the implementation to use.

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

AddDispatcher<TDispatcher, TImplementation>()

Adds a dispatcher of type TDispatcher to DispatcherServiceTypes (if not already registered) and DispatcherImplementationTypes (if not already registered).

public SavvyioOptions AddDispatcher<TDispatcher, TImplementation>()
    where TDispatcher : IDispatcher where TImplementation : class, TDispatcher

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

Type Parameters

TDispatcher

The type of the IDispatcher interface to add.

TImplementation

The type of the implementation to use.

AddHandler(Type, Type)

Adds a dispatcher of type IHandler to HandlerServiceTypes (if not already registered) and HandlerImplementationTypes (if not already registered).

public SavvyioOptions AddHandler(Type service, Type implementation)

Parameters

service Type

The System.Type of the IHandler interface to add.

implementation Type

The type of the implementation to use.

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

AddHandler<THandler, TRequest, TImplementation>()

Adds a handler of type THandler to HandlerServiceTypes (if not already registered) and HandlerImplementationTypes (if not already registered).

public SavvyioOptions AddHandler<THandler, TRequest, TImplementation>()
    where THandler : IHandler<TRequest> where TRequest : IRequest where TImplementation : class, THandler

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

Type Parameters

THandler

The type of the service to add.

TRequest

The type of the model to handle.

TImplementation

The type of the implementation to use.

Remarks

Handler is only added if the following conditions are true: typeof(THandler).HasInterfaces(typeof(IHandler<TRequest>)) && typeof(T).IsClass && !typeof(T).IsAbstract && !typeof(T).IsInterface

EnableDispatcherDiscovery(Boolean)

Enables discovery of dispatchers implementing the IDispatcher interface using assembly scanning.

public SavvyioOptions EnableDispatcherDiscovery(bool allowDispatcherDiscovery = true)

Parameters

allowDispatcherDiscovery Boolean

true if dispatchers implementing the IDispatcher interface are allowed to be discovered using assembly scanning; otherwise, false.

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

EnableHandlerDiscovery(Boolean)

Enables discovery of handlers implementing the IHandler interface using assembly scanning.

public SavvyioOptions EnableHandlerDiscovery(bool allowHandlerDiscovery = true)

Parameters

allowHandlerDiscovery Boolean

true if handlers implementing the IHandler interface are allowed to be discovered using assembly scanning; otherwise, false.

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

EnableHandlerServicesDescriptor(Boolean)

Enables the inclusion of the HandlerServicesDescriptor that provides an overview of all handlers presented in a detailed and developer friendly way.

public SavvyioOptions EnableHandlerServicesDescriptor(bool includeHandlerServicesDescriptor = true)

Parameters

includeHandlerServicesDescriptor Boolean

true enables the inclusion of the HandlerServicesDescriptor that provides an overview of all handlers presented in a detailed and developer friendly way; otherwise, false.

Returns

SavvyioOptions

A reference to this instance so that additional configuration calls can be chained.

IsValid<T>(Type, Type)

Determines if a given pair of types are a valid as a dependency.

public static bool IsValid<T>(Type provider, Type contract)

Parameters

provider Type

The provider type.

contract Type

The contract type.

Returns

Boolean

true if the specified provider is a valid dependency; otherwise, false.

Type Parameters

T

The type of the service to validate.

Remarks

Dependency formula: provider.HasInterfaces(contract) && provider.IsClass && !provider.IsAbstract && !provider.IsInterface