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 section for
write-side settings.
public static IServiceCollection AddWriteStore(this IServiceCollection services, IConfiguration configuration)
Parameters
servicesIServiceCollectionThe service collection to register options on.
configurationIConfigurationThe 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));
Remarks
The section holds EventSourcing:AppendAgainstAggregatedVersion and
EventSourcing:NewStreamOwnerFromSession. AddEventSourcing() binds the same section from the
container's configuration and validates the policy at start; a host that calls both and passes this method
another configuration gets the value of whichever registration comes later. How often an aggregate is
snapshotted is not configuration: it is the registered ISnapshotStrategy.