DBreeze.Scheme.DeleteTable C# (CSharp) Method

DeleteTable() public method

Deletes user table
public DeleteTable ( string userTableName ) : void
userTableName string
return void
        public void DeleteTable(string userTableName)
        {
            string tableName = GetUserTableNameAsString(userTableName);
            this.cachedTableNames.Remove(tableName);

            //Blocking Schema
            _sync_openTablesHolder.EnterWriteLock();
            try
            {
                if (_openTablesHolder.ContainsKey(tableName))
                {
                    //Someone can use this table
                    //We dispose table, what will cause disposing DBstorage and RollbackStorage
                    //In this moment parallel reading table threads inside of Iterations, can get Exceptions - What is acceptable for now.
                    _openTablesHolder[tableName].Dispose();

                    _openTablesHolder[tableName] = null;

                    //Deleting table from the holder
                    _openTablesHolder.Remove(tableName);
                }

                //Trying to get full file name, via globilzed function which will also support mapping outside the DB main directory
                string physicalDbFileName = GetPhysicalPathToTheUserTable(userTableName);

                if (physicalDbFileName == String.Empty)
                    return; //fake

                //Removing record from the schema

                byte[] btTableName = GetUserTableNameAsByte(userTableName);

                //ulong cc = LTrie.Count();
                LTrie.Remove(ref btTableName);
                LTrie.Commit();
                //cc = LTrie.Count();

                //Deleting file physically
                if (physicalDbFileName != "MEMORY")
                    DeleteAllReleatedTableFiles(physicalDbFileName);
            }
            catch (System.Exception ex)
            {
                DBreezeException.Throw(DBreezeException.eDBreezeExceptions.SCHEME_TABLE_DELETE_FAILED, userTableName, ex);
            }
            finally
            {
                _sync_openTablesHolder.ExitWriteLock();
            }
        }