コード例 #1
0
ファイル: SchemaCreation.cs プロジェクト: preardon/Brighter
        private static void CreateOutboxDevelopment(string connectionString)
        {
            using var sqlConnection = new SqliteConnection(connectionString);
            sqlConnection.Open();

            using var exists   = sqlConnection.CreateCommand();
            exists.CommandText = SqliteOutboxBuilder.GetExistsQuery(OUTBOX_TABLE_NAME);
            using var reader   = exists.ExecuteReader(CommandBehavior.SingleRow);

            if (reader.HasRows)
            {
                return;
            }

            using var command   = sqlConnection.CreateCommand();
            command.CommandText = SqliteOutboxBuilder.GetDDL(OUTBOX_TABLE_NAME);
            command.ExecuteScalar();
        }
コード例 #2
0
 public void SetupMessageDb()
 {
     connectionStringPath = GetUniqueTestDbPathAndCreateDir();
     ConnectionString     = $"DataSource=\"{connectionStringPath}\"";
     CreateDatabaseWithTable(ConnectionString, SqliteOutboxBuilder.GetDDL(TableName_Messages));
 }