Esempio n. 1
0
        public Page AllocatePage(int num)
        {
            Page page = _freeSpaceRepository.TryAllocateFromFreeSpace(this, num);

            if (page == null)             // allocate from end of file
            {
                if (num > 1)
                {
                    _pager.EnsureContinious(this, NextPageNumber, num);
                }
                page            = _pager.Get(this, NextPageNumber);
                page.PageNumber = NextPageNumber;
                NextPageNumber += num;
            }
            page.Lower = (ushort)Constants.PageHeaderSize;
            page.Upper = (ushort)_pager.PageSize;
            page.Dirty = true;
            _dirtyPages[page.PageNumber] = page.PageNumber;
            return(page);
        }