Skip to main content
Table of Contents

Class WriteStoreServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Stratara.EventSourcing.EntityFrameworkCore.dll

Service-collection extensions for the Stratara write store.

public static class WriteStoreServiceCollectionExtensions
Inheritance
WriteStoreServiceCollectionExtensions
Inherited Members

Methods

AddWriteStore(IServiceCollection, IConfiguration)

Binds EventSourcingOptions from the EventSourcing configuration section. The options carry no settings today; the section is reserved for write-side settings. How often an aggregate is snapshotted is not configuration: it is the registered ISnapshotStrategy.

public static IServiceCollection AddWriteStore(this IServiceCollection services, IConfiguration configuration)

Parameters

services IServiceCollection

The service collection to register options on.

configuration IConfiguration

The host configuration providing the options section.

Returns

IServiceCollection

The same IServiceCollection for chaining.

Examples

services.AddWriteStore(configuration);

// Snapshot cadence is a strategy, not a key: every 100 events instead of the default 50.
services.AddSingleton<ISnapshotStrategy>(new VersionThresholdSnapshotStrategy(threshold: 100));