예제 #1
0
        public async Task <ImmutableList <IFileReference> > SearchFileReferencesAsync(string searchTerm, CancellationToken token)
        {
            if (string.IsNullOrWhiteSpace(searchTerm))
            {
                return(ImmutableList <IFileReference> .Empty);
            }

            var searchResult = await _searchResultCollection.AddOrUpdate
                               (
                searchTerm,
                () => _graphQLService.GetFileReferencesAsync(searchTerm, token)
                               );

            return(FileReferencesFactory.Create(searchResult.JsonResult));
        }
예제 #2
0
        public IObservable <IEnumerable <IFileReference> > SearchFileReferences(string searchTerm, CancellationToken token)
        {
            return(Observable.Defer <IEnumerable <IFileReference> >(async() =>
            {
                var searchResult = await _searchResultCollection.AddOrUpdate
                                   (
                    searchTerm,
                    () => _graphQLService.GetFileReferencesAsync(searchTerm, token)
                                   );

                var fileReferences = FileReferencesFactory.Create(searchResult.JsonResult);

                return Observable.Return <IEnumerable <IFileReference> >(fileReferences);
            }));
        }