protected override async Task <Entry> LoadEntryAsync(Id entryId, IProgress <double> progress, CancellationToken cancellationToken) { if (Id.IsNullOrDefault(entryId)) { throw new ArgumentException("The given id was null or default."); } if (_offlineDatabase.ContainsKey(entryId)) { return(_offlineDatabase[entryId]); } if (_offlineDatabase.Count == 0) { Logger?.LogWarning($"{nameof(OfflineDatabase)} is empty. Did you forget to call the {nameof(LoadAll)} method?"); } if (FallbackProvider != null) { return(await FallbackProvider.GetEntryAsync(entryId, cancellationToken, progress)); } Logger?.LogWarning($"{nameof(OfflineDatabase)} is not able to load entry corresponding to \"{entryId}\" " + $"because no {nameof(FallbackProvider)} has been set."); return(DefaultEntry.Instance); }
public override async Task <IList <SearchResult> > GetSearchResultsAsync(string searchQuery, CancellationToken cancellationToken, IProgress <double> progress = null) { if (FallbackProvider != null) { return(await FallbackProvider.GetSearchResultsAsync(searchQuery, cancellationToken, progress)); } Logger?.LogWarning($"{nameof(OfflineDatabase)} is not able to search for \"{searchQuery}\" " + $"because no {nameof(FallbackProvider)} has been set."); return(new List <SearchResult>()); }