Beispiel #1
0
        private CacheItem LoadDocument(long rowId, IOperationContext operationContext)
        {
            ITransaction transaction = null;

            try
            {
                //transaction = _persistenceManager.BeginTransaction(null, true);
                var       document = _persistenceManager.GetDocument(_parent.Name, rowId);
                CacheItem cItem    = new CacheItem()
                {
                    Document = document
                };
                //If query exection then cache insert is optional
                if (operationContext.ContainsKey(ContextItem.QueryExecution) && _cacheSpace.IsFull)
                {
                    return(cItem);
                }
                CacheInsert(rowId, cItem);
                return(cItem);
            }
            catch (Exception e)
            {
                Console.WriteLine("Read Through Exception " + e);
                if (LoggerManager.Instance.StorageLogger != null && LoggerManager.Instance.StorageLogger.IsErrorEnabled)
                {
                    LoggerManager.Instance.StorageLogger.Error("Exception Reading Thru : Collection = " + Name, " Row ID: " + rowId + " and Exception is = " + e);
                }

                throw;
            }
            finally
            {
                if (transaction != null)
                {
                    _persistenceManager.Commit(transaction);
                }
            }
        }