Пример #1
0
        public void ReleaseStore(TableBase table)
        {
            IPersistentStore store = this._rowStoreMap.Get(table.GetPersistenceId());

            if (store != null)
            {
                store.Release();
                this._rowStoreMap.Remove(table.GetPersistenceId());
            }
        }
        public IPersistentStore GetStore(object key)
        {
            try
            {
                TableBase table = (TableBase)key;
                switch (table.PersistenceScope)
                {
                case 0x15:
                {
                    IPersistentStore store = this._rowStoreMapStatement.Get(table.GetPersistenceId());
                    if (store == null)
                    {
                        store = this._session.database.logger.NewStore(this._session, this, table, true);
                    }
                    return(store);
                }

                case 0x16:
                case 0x18:
                {
                    IPersistentStore store3 = this._rowStoreMapTransaction.Get(table.GetPersistenceId());
                    if (store3 == null)
                    {
                        store3 = this._session.database.logger.NewStore(this._session, this, table, true);
                    }
                    return(store3);
                }

                case 0x17:
                {
                    IPersistentStore store4 = this._rowStoreMapSession.Get(table.GetPersistenceId());
                    if (store4 == null)
                    {
                        store4 = this._session.database.logger.NewStore(this._session, this, table, true);
                    }
                    return(store4);
                }
                }
            }
            catch (CoreException)
            {
            }
            throw Error.RuntimeError(0xc9, "PersistentStoreCollectionSession");
        }
        public void SetStore(object key, IPersistentStore store)
        {
            TableBase base2 = (TableBase)key;

            switch (base2.PersistenceScope)
            {
            case 0x15:
                if (store != null)
                {
                    this._rowStoreMapStatement.Put(base2.GetPersistenceId(), store);
                    return;
                }
                this._rowStoreMapStatement.Remove(base2.GetPersistenceId());
                return;

            case 0x16:
            case 0x18:
                if (store != null)
                {
                    this._rowStoreMapTransaction.Put(base2.GetPersistenceId(), store);
                    return;
                }
                this._rowStoreMapTransaction.Remove(base2.GetPersistenceId());
                return;

            case 0x17:
                if (store != null)
                {
                    this._rowStoreMapSession.Put(base2.GetPersistenceId(), store);
                    return;
                }
                this._rowStoreMapSession.Remove(base2.GetPersistenceId());
                return;
            }
            throw Error.RuntimeError(0xc9, "PersistentStoreCollectionSession");
        }