Table of Contents

ServiceCollectionExtensions Class

Definition

Extension methods for the IServiceCollection interface.

public static class ServiceCollectionExtensions
Inheritance
object
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

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

Adds an AzureCommandQueue implementation to the specified IServiceCollection.

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

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

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

Adds an AzureEventBus implementation to the specified IServiceCollection.

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

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