Exemplo n.º 1
0
        /// <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));
            }
        }
Exemplo n.º 2
0
        /// <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();
        }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
 /// <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)
 {
 }
Exemplo n.º 5
0
        /// <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);
            }
        }
Exemplo n.º 6
0
 /// <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)
 {
 }