Пример #1
0
        /// <summary>
        /// Add a dataset to the cache
        /// </summary>
        /// <param name="dataSet">The dataset</param>
        /// <param name="name">A name for the dataset used to retrieve it later</param>
        /// <param name="queryCriteria">The criteria used to create the dataset.
        /// This is used so that later when you retrieve the dataset you only get
        /// it back if it has the same criteria</param>
        public void Add(FileStream fileStream, string name)
        {
            lock (_caches)
                if (_caches.ContainsKey(name))
                {
                    _caches.Remove(name);
                }

            FileStreamCache fileStreamCache = new FileStreamCache();

            fileStreamCache.FileStream = fileStream;
            lock (_caches)
                _caches.Add(name, fileStreamCache);
        }
        /// <summary>
        /// Add a dataset to the cache
        /// </summary>
        /// <param name="dataSet">The dataset</param>
        /// <param name="name">A name for the dataset used to retrieve it later</param>
        /// <param name="queryCriteria">The criteria used to create the dataset.  
        /// This is used so that later when you retrieve the dataset you only get
        /// it back if it has the same criteria</param>
        public void Add(FileStream fileStream, string name)
        {
            lock (_caches)
                if (_caches.ContainsKey(name))
                {
                    _caches.Remove(name);
                }

            FileStreamCache fileStreamCache = new FileStreamCache();
            fileStreamCache.FileStream = fileStream;
            lock (_caches)
                _caches.Add(name, fileStreamCache);
        }