public static void AddEventStore(this IServiceCollection services, IAmazonDynamoDB client, Action <DynamoEventStoreOptions> configure = null) { var options = new DynamoEventStoreOptions(); configure?.Invoke(options); services.AddSingleton(options); services.AddSingleton <IAmazonDynamoDB>(client); services.AddSingleton <ICelebrityEventStoreConfiguration, DynamoDbEventStoreConfiguration>(); services.AddAsyncInitializer <DynamoDbEventStoreInitializer>(); services.AddSingleton <ICelebrityEventStore, DynamoDbCelebrityEventStore>(); }
public DynamoDbEventStoreConfiguration(IAmazonDynamoDB dynamoDb, DynamoEventStoreOptions options) { _dynamoDb = dynamoDb ?? throw new ArgumentNullException(nameof(dynamoDb)); Options = options ?? throw new ArgumentNullException(nameof(options)); }