/// <summary> /// Gets all articles /// </summary> /// <param name="noCache"></param> /// <returns></returns> private IEnumerable <Article> GetAllArticles(bool noCache = false) { #if DEBUG this.WriteDebugLine(); #endif var articles = cacheProvider.All(); if (!articles.Any() || noCache) { #if DEBUG this.WriteDebugLine(message: "No cache"); #endif articles = GetAll(); foreach (var article in articles) { article.Author ??= configuration.DefaultAuthor; } cacheProvider.Set(articles); } #if DEBUG this.WriteDebugLine(message: $"return {articles.Count()} articles"); #endif return(articles); }
private IEnumerable <Article> GetAllArticles() { #if DEBUG this.WriteDebugLine(); #endif var articles = cacheProvider.All(); if (!articles.Any()) { #if DEBUG this.WriteDebugLine(message: "No cache"); #endif articles = GetAll(); cacheProvider.Set(articles); } #if DEBUG this.WriteDebugLine(message: $"return {articles.Count()} articles"); #endif return(articles); }