public async Task <List <SmartContractDto> > GetAllSmartContractsByNameAsync(SmartContractName name) { FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 }; return(_documentClient.CreateDocumentQuery <SmartContractDto>( UriFactory.CreateDocumentCollectionUri(_databaseName, _documentCollectionName), queryOptions) .Where(i => i.Name == name) .AsEnumerable() .ToList()); }
public async Task <SmartContractDto> GetLatestVersionSmartContractByName(SmartContractName name) { try { return(await _smartContractStoreService.GetLatestVersionSmartContractByNameAsync(name)); } catch (FabricServiceNotFoundException notFoundex) { throw new Exception( $"Unable to communicate with the SmartContractStoreService to get the Smart contract. Reason: {notFoundex.Message}"); } catch (Exception ex) { throw new Exception($"Unable to communicate with the SmartContractStoreService reason: {ex} "); } }
public async Task <SmartContractDto> GetLatestVersionSmartContractByNameAsync(SmartContractName name) { FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 }; var items = _documentClient.CreateDocumentQuery <SmartContractDto>( UriFactory.CreateDocumentCollectionUri(_databaseName, _documentCollectionName), queryOptions) .Where(i => i.Name == name) .AsEnumerable() .ToList(); if (items.Count == 0) { throw new Exception($"No contracts of any kind matching name {name} was found in the document DB collection {_documentCollectionName}"); } return(items.OrderByDescending(v => v.Version).FirstOrDefault()); }
public async Task <SmartContractDto> GetLatestVersionSmartContractByNameAsync(SmartContractName name) { return(await _smartContractsRepository.GetLatestVersionSmartContractByNameAsync(name)); }
public async Task <List <SmartContractDto> > GetAllSmartContractsByNameAsync(SmartContractName name) { return(await _smartContractsRepository.GetAllSmartContractsByNameAsync(name)); }