/// <summary> /// Creates a <see cref="DataTable"/> based on the required insert/update command parameters. /// </summary> private static DbBatchOperation CreateBuffer(IStoreEventSettings settings, IEventStoreDialect dialect) { using (var command = dialect.CreateCommand(dialect.MarkDispatched)) { command.Parameters.Add(dialect.CreateIdParameter(default(Int64))); return(new DbBatchOperation(dialect, command, settings.BatchSize, settings.FlushInterval)); } }
/// <summary> /// Initializes a new instance of <see cref="SqlEventStore"/> with a custom <see cref="IEventStoreDialect"/>. /// </summary> /// <param name="dialect">The database dialect associated with this <see cref="SqlEventStore"/>.</param> /// <param name="serializer">The <see cref="ISerializeObjects"/> used to store binary data.</param> /// <param name="settings">The event store settings.</param> internal SqlEventStore(IEventStoreDialect dialect, ISerializeObjects serializer, IStoreEventSettings settings) { Verify.NotNull(serializer, nameof(serializer)); Verify.NotNull(settings, nameof(settings)); Verify.NotNull(dialect, nameof(dialect)); this.dialect = dialect; this.serializer = serializer; this.pageSize = settings.PageSize; this.useAsyncWrite = settings.Async; this.detectDuplicateCommits = settings.DetectDuplicateCommits; this.dispatchedBuffer = settings.Async ? CreateBuffer(settings, dialect) : null; Initialize(); }
/// <summary> /// Initializes a new instance of <see cref="SqlEventStore"/>. /// </summary> /// <param name="dialect">The database dialect associated with this <see cref="SqlEventStore"/>.</param> /// <param name="serializer">The <see cref="ISerializeObjects"/> used to store binary data.</param> public SqlEventStore(IEventStoreDialect dialect, ISerializeObjects serializer) : this(dialect, serializer, Settings.EventStore) { }
/// <summary> /// Creates a <see cref="DataTable"/> based on the required insert/update command parameters. /// </summary> private static DbBatchOperation CreateBuffer(IStoreEventSettings settings, IEventStoreDialect dialect) { using (var command = dialect.CreateCommand(dialect.MarkDispatched)) { command.Parameters.Add(dialect.CreateIdParameter(default(Int64))); return new DbBatchOperation(dialect, command, settings.BatchSize, settings.FlushInterval); } }