public void AcquireTableWriteLock(ITable table, Transaction transaction)
        {
            IList <ITable> tables    = this.database.Tables.GetAllTables();
            ILock          tableLock = this.tableLocks[table];

            var lockInfo = this.lockInventory.GetLockInformation(tableLock, transaction);

            if (!lockInfo.IsWriteLockHeld)
            {
                // TODO: OnWaiting
                if (lockInfo.IsReadLockHeld)
                {
                    tableLock.Upgrade();
                }
                else
                {
                    tableLock.EnterWrite();
                }

                // TODO: OnReleased
                lockInfo.IsWriteLockHeld = true;
            }

            ////switch (this.deadlockManagement)
            ////{
            ////    #region Deadlock detection

            ////    case DeadlockManagementStrategies.DeadlockDetection:

            ////        if (!tableLock.IsWriteLockHeld)
            ////        {
            ////            this.WaitsFor(tableLock);

            ////            tableLock.EnterWriteLock();

            ////            this.LockAquired(tableLock);
            ////        }
            ////        break;
            ////    #endregion

            ////    #region Deadlock prevention

            ////    case DeadlockManagementStrategies.DeadlockPrevention:

            ////        throw new NotSupportedException();

            ////        if (!tableLock.IsWriteLockHeld)
            ////        {
            ////            for (int i = 0; i < tables.Count; i++)
            ////            {
            ////                if (tables[i] == table)
            ////                {
            ////                    for (int l = i + 1; l < tables.Count; l++)
            ////                    {
            ////                        ILock otherLock = this.tableLocks[tables[l]];

            ////                        if (!otherLock.IsWriteLockHeld)
            ////                        {
            ////                            this.WaitsFor(otherLock);
            ////                            otherLock.EnterWriteLock();
            ////                            this.LockAquired(otherLock);
            ////                        }
            ////                    }

            ////                    this.WaitsFor(tableLock);
            ////                    tableLock.EnterWriteLock();
            ////                    this.LockAquired(tableLock);
            ////                    break;
            ////                }
            ////            }
            ////        }

            ////        break;

            ////    #endregion
            ////}
        }