/// <summary> /// Sets the underling value after the query has been executed. /// </summary> /// <param name="result">The <see cref="IMultipleResults"/> to get the result from.</param> protected virtual void SetResult(IMultipleResults result) { _isLoaded = true; List <T> resultList = null; try { var resultSet = result.GetResult <T>(); resultList = resultSet != null?resultSet.ToList() : new List <T>(); _result = resultList; } catch (Exception ex) { Exception = ex; } if (_cacheSettings == null || resultList == null) { return; } // cache the result string key = GetKey(); QueryResultCache.SetResultCache(key, _cacheSettings, resultList); }
/// <summary> /// Checks the cache for the results. /// </summary> private void CheckCache() { if (_cacheSettings == null) { return; } string key = GetKey(); ICollection <T> cached = QueryResultCache.GetResultCache <T>(key, _cacheSettings); if (cached == null) { return; } _isLoaded = true; _result = cached; }