Beispiel #1
0
        /// <summary>
        /// Gets the DBRecord for a particular ID.
        /// </summary>
        /// <param name="recordId">string ID of the record will be normalized internally</param>
        /// <returns>DBRecord corresponding to the string ID.</returns>
        public DBRecordCollection GetItem(ArzFile file, string recordId)
        {
            if (string.IsNullOrEmpty(recordId))
            {
                return(null);
            }

            recordId = TQData.NormalizeRecordPath(recordId);

            return(file.Cache.GetOrAddAtomic(recordId, k =>
            {
                RecordInfo rawRecord;
                if (file.RecordInfo.ContainsKey(k))
                {
                    rawRecord = file.RecordInfo[k].Value;
                }
                else
                {
                    // record not found
                    return null;
                }

                return infoProv.Decompress(file, rawRecord);
            }));
        }
Beispiel #2
0
        /// <summary>
        /// Gets the DBRecord for a particular ID.
        /// </summary>
        /// <param name="recordId">string ID of the record will be normalized internally</param>
        /// <returns>DBRecord corresponding to the string ID.</returns>
        public DBRecordCollection GetItem(ArzFile file, string recordId)
        {
            if (string.IsNullOrEmpty(recordId))
            {
                return(null);
            }

            DBRecordCollection databaseRecord;

            recordId = TQData.NormalizeRecordPath(recordId);

            if (file.Cache.ContainsKey(recordId))
            {
                databaseRecord = file.Cache[recordId];
            }
            else
            {
                RecordInfo rawRecord;

                if (file.RecordInfo.ContainsKey(recordId))
                {
                    rawRecord = file.RecordInfo[recordId];
                }
                else
                {
                    // record not found
                    return(null);
                }

                databaseRecord = infoProv.Decompress(file, rawRecord);
                file.Cache.Add(recordId, databaseRecord);
            }

            return(databaseRecord);
        }