コード例 #1
0
        public virtual async Task <bool> NeedToCreateClientScopeInfoTableAsync()
        {
            var command = connection.CreateCommand();

            if (transaction != null)
            {
                command.Transaction = transaction;
            }
            bool alreadyOpened = connection.State == ConnectionState.Open;

            try
            {
                if (!alreadyOpened)
                {
                    await connection.OpenAsync().ConfigureAwait(false);
                }

                var exist = await NpgsqlManagementUtils.TableExistsAsync(connection, transaction, this.scopeTableName.Quoted().ToString());

                return(!exist);
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error during NeedToCreateScopeInfoTable command : {ex}");
                throw;
            }
            finally
            {
                if (!alreadyOpened && connection.State != ConnectionState.Closed)
                {
                    connection.Close();
                }

                if (command != null)
                {
                    command.Dispose();
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Check if we need to create the table in the current database
 /// </summary>
 public async Task <bool> NeedToCreateTableAsync()
 {
     return(!await NpgsqlManagementUtils.TableExistsAsync(connection, transaction, tableName.Schema().Quoted().ToString()).ConfigureAwait(false));
 }
コード例 #3
0
        public virtual async Task <bool> NeedToCreateClientScopeInfoTableAsync(DbConnection connection, DbTransaction transaction)
        {
            var exist = await NpgsqlManagementUtils.TableExistsAsync((NpgsqlConnection)connection, (NpgsqlTransaction)transaction, this.scopeTableName.Quoted().ToString());

            return(!exist);
        }
コード例 #4
0
 public async Task <bool> NeedToCreateTrackingTableAsync(DbConnection connection, DbTransaction transaction) =>
 !await NpgsqlManagementUtils.TableExistsAsync((NpgsqlConnection)connection, (NpgsqlTransaction)transaction, trackingName.Schema().Quoted().ToString()).ConfigureAwait(false);