DBreeze.Scheme.CloseTables C# (CSharp) Method

CloseTables() private method

Called by Transaction, when it's time to be Disposed and close tables. Tables will be closed only in case of other threads don't use it.
private CloseTables ( ulong?>.Dictionary closeOpenTables ) : void
closeOpenTables ulong?>.Dictionary
return void
        internal void CloseTables(Dictionary<string, ulong?> closeOpenTables)
        {
            //if (Engine.Configuration.Storage == DBreezeConfiguration.eStorage.MEMORY)
            //    return;

            string tableName = String.Empty;
            OpenTable ot = null;
            bool toClose = false;

            string alternativeTableLocation = String.Empty;

            _sync_openTablesHolder.EnterWriteLock();
            try
            {
                //utn - user table name
                foreach (var utn in closeOpenTables)
                {

                    if (CheckAlternativeTableLocationsIntersections(utn.Key, out alternativeTableLocation))
                    {
                        if (alternativeTableLocation == String.Empty)
                        {
                            //Memory table, we don't close
                            continue;
                        }
                        else
                        {
                            //Physical table...going on
                        }
                    }
                    else
                    {
                        //Table location is not overridden, working further based on main DBreeze configuration
                        if (Engine.Configuration.Storage == DBreezeConfiguration.eStorage.MEMORY)
                            continue;   //we don't close memory tables
                    }

                    tableName = GetUserTableNameAsString(utn.Key);

                    _openTablesHolder.TryGetValue(tableName, out ot);

                    if (ot != null)
                    {
                        toClose = ot.Remove((ulong)utn.Value);

                        if (AutoCloseOpenTables)    //If AutoCloseIsEnabled, we dispose LTrie and closing physical file.
                        {
                            if (toClose)
                            {
                                //Closing table

                                //Console.WriteLine("Closing: " + utn.Key);

                                ot.Dispose();

                                _openTablesHolder.Remove(tableName);
                            }
                        }
                    }
                    //else
                    //{
                    //}
                }

            }
            finally
            {
                _sync_openTablesHolder.ExitWriteLock();
            }
        }