Exemplo n.º 1
0
        /// <summary>
        /// Get collection page instance (or create a new one)
        /// </summary>
        public void Get(string name, bool addIfNotExists, ref CollectionPage collectionPage)
        {
            // get collection pageID from header
            var pageID = _header.GetCollectionPageID(name);

            if (pageID != uint.MaxValue)
            {
                collectionPage = _snapshot.GetPage <CollectionPage>(pageID);
            }
            else if (addIfNotExists)
            {
                this.Add(name, ref collectionPage);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get collection page instance (or create a new one). Returns null if not found and not created
        /// </summary>
        public async Task <CollectionPage> Get(string name, bool addIfNotExists)
        {
            // get collection pageID from header
            var pageID = _header.GetCollectionPageID(name);

            if (pageID != uint.MaxValue)
            {
                return(await _snapshot.GetPage <CollectionPage>(pageID));
            }
            else if (addIfNotExists)
            {
                return(await this.Add(name));
            }

            return(null);
        }