Table of Contents

Class ServiceCollectionExtensions

Namespace
Savvyio.Extensions.DependencyInjection.QueueStorage
Assembly
Savvyio.Extensions.DependencyInjection.QueueStorage.dll

Extension methods for the IServiceCollection interface.

public static class ServiceCollectionExtensions
Inheritance
ServiceCollectionExtensions

Examples

Register Azure Queue Storage command queues and event buses in the DI container with AddAzureCommandQueue and AddAzureEventBus.

using System;
using Microsoft.Extensions.DependencyInjection;
using Savvyio.Extensions.DependencyInjection;
using Savvyio.Extensions.DependencyInjection.QueueStorage;

namespace ExampleApp;

public static class AzureQueueRegistration
{
    public static IServiceCollection Configure(IServiceCollection services)
    {
        services.AddSavvyIO();
        services.AddAzureCommandQueue(
            o => { o.ConnectionString = "UseDevelopmentStorage=true"; o.QueueName = "commands"; });
        services.AddAzureEventBus(
            azureQueueSetup: o => { o.ConnectionString = "UseDevelopmentStorage=true"; o.QueueName = "events"; },
            azureEventBusSetup: o => { o.TopicEndpoint = new Uri("https://myeventgridtopic.westeurope-1.eventgrid.azure.net/api/events"); });
        return services;
    }
}

Methods

AddAzureCommandQueue(IServiceCollection, Action<AzureQueueOptions>, Action<ServiceOptions>)

Adds an AzureCommandQueue implementation to the specified IServiceCollection.

public static IServiceCollection AddAzureCommandQueue(this IServiceCollection services, Action<AzureQueueOptions> azureQueueSetup, Action<ServiceOptions> serviceSetup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

azureQueueSetup Action<AzureQueueOptions>

The AzureQueueOptions that needs to be configured.

serviceSetup Action<ServiceOptions>

The ServiceOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

The implementation will be type forwarded accordingly.

Exceptions

ArgumentNullException

services cannot be null.

AddAzureCommandQueue<TMarker>(IServiceCollection, Action<AzureQueueOptions<TMarker>>, Action<ServiceOptions>)

Adds an AzureCommandQueue<TMarker> implementation to the specified IServiceCollection.

public static IServiceCollection AddAzureCommandQueue<TMarker>(this IServiceCollection services, Action<AzureQueueOptions<TMarker>> azureQueueSetup, Action<ServiceOptions> serviceSetup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

azureQueueSetup Action<AzureQueueOptions<TMarker>>

The AzureQueueOptions<TMarker> that needs to be configured.

serviceSetup Action<ServiceOptions>

The ServiceOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Type Parameters

TMarker

Remarks

The implementation will be type forwarded accordingly.

Exceptions

ArgumentNullException

services cannot be null.

AddAzureEventBus(IServiceCollection, Action<AzureQueueOptions>, Action<AzureEventBusOptions>, Action<ServiceOptions>)

Adds an AzureEventBus implementation to the specified IServiceCollection.

public static IServiceCollection AddAzureEventBus(this IServiceCollection services, Action<AzureQueueOptions> azureQueueSetup, Action<AzureEventBusOptions> azureEventBusSetup, Action<ServiceOptions> serviceSetup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

azureQueueSetup Action<AzureQueueOptions>

The AzureQueueOptions that needs to be configured.

azureEventBusSetup Action<AzureEventBusOptions>

The AzureEventBusOptions that needs to be configured.

serviceSetup Action<ServiceOptions>

The ServiceOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

The implementation will be type forwarded accordingly.

Exceptions

ArgumentNullException

services cannot be null.

AddAzureEventBus<TMarker>(IServiceCollection, Action<AzureQueueOptions<TMarker>>, Action<AzureEventBusOptions<TMarker>>, Action<ServiceOptions>)

Adds an AzureEventBus<TMarker> implementation to the specified IServiceCollection.

public static IServiceCollection AddAzureEventBus<TMarker>(this IServiceCollection services, Action<AzureQueueOptions<TMarker>> azureQueueSetup, Action<AzureEventBusOptions<TMarker>> azureEventBusSetup, Action<ServiceOptions> serviceSetup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

azureQueueSetup Action<AzureQueueOptions<TMarker>>

The AzureQueueOptions<TMarker> that needs to be configured.

azureEventBusSetup Action<AzureEventBusOptions<TMarker>>

The AzureEventBusOptions<TMarker> that needs to be configured.

serviceSetup Action<ServiceOptions>

The ServiceOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Type Parameters

TMarker

Remarks

The implementation will be type forwarded accordingly.

Exceptions

ArgumentNullException

services cannot be null.