/// <summary> /// Initializes a new instance of the <see cref="SqLiteMessageQueueSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="options">The options.</param> public SqLiteMessageQueueSchema(TableNameHelper tableNameHelper, ISqLiteMessageQueueTransportOptionsFactory options) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => options, options); _tableNameHelper = tableNameHelper; _options = new Lazy<SqLiteMessageQueueTransportOptions>(options.Create); }
/// <summary> /// Initializes a new instance of the <see cref="SqLiteCommandStringCache" /> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> public SqLiteCommandStringCache(TableNameHelper tableNameHelper) { Guard.NotNull(() => tableNameHelper, tableNameHelper); _tableNameHelper = tableNameHelper; _commandCache = new Dictionary<SqLiteCommandStringTypes, string>(); _commandCacheRunTime = new ConcurrentDictionary<string, CommandString>(); BuildCommands(); }
public static void SetError(string queueName, string connectionString) { var connection = new SqliteConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new SQLiteConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"update {helper.StatusName} set status = 2"; command.ExecuteNonQuery(); } } }
/// <summary> /// Initializes a new instance of the <see cref="SqliteJobTableCreation" /> class. /// </summary> /// <param name="queryTableExists">The query table exists.</param> /// <param name="createSchema">The create schema.</param> /// <param name="createCommand">The create command.</param> /// <param name="connectionInfo">The connection information.</param> /// <param name="tableNameHelper">The table name helper.</param> public SqliteJobTableCreation(IQueryHandler<GetTableExistsQuery, bool> queryTableExists, SqliteJobSchema createSchema, ICommandHandlerWithOutput<CreateJobTablesCommand, QueueCreationResult> createCommand, IConnectionInformation connectionInfo, TableNameHelper tableNameHelper ) { Guard.NotNull(() => createSchema, createSchema); Guard.NotNull(() => queryTableExists, queryTableExists); Guard.NotNull(() => createCommand, createCommand); Guard.NotNull(() => connectionInfo, connectionInfo); Guard.NotNull(() => tableNameHelper, tableNameHelper); _createSchema = createSchema; _queryTableExists = queryTableExists; _createCommand = createCommand; _connection = connectionInfo; _tableNameHelper = tableNameHelper; }
public static void Verify(string queueName, string connectionString, long messageCount) { var connection = new SqliteConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new SQLiteConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"select count(*) from {helper.MetaDataName}"; using (var reader = command.ExecuteReader()) { Assert.True(reader.Read()); var records = reader.GetInt32(0); Assert.Equal(messageCount, records); } } } }
/// <summary> /// Initializes a new instance of the <see cref="SqliteJobSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> public SqliteJobSchema(TableNameHelper tableNameHelper) { _tableNameHelper = tableNameHelper; }
public VerifyQueueData(string queueName, string connectionString, SqLiteMessageQueueTransportOptions options) { _options = options; _connection = new SqliteConnectionInformation(queueName, connectionString); _tableNameHelper = new TableNameHelper(_connection); }
public VerifyErrorCounts(string queueName, string connectionString) { _connection = new SqliteConnectionInformation(queueName, connectionString); _tableNameHelper = new TableNameHelper(_connection); }
private SqLiteMessageQueueSchema Create(ISqLiteMessageQueueTransportOptionsFactory options, TableNameHelper tableNameHelper) { return new SqLiteMessageQueueSchema(tableNameHelper, options); }