/// <summary> /// Gets the serialized results from storage with validation to check for errors while downloading /// </summary> /// <param name="key">Unique identifier to get the result information</param> /// <returns>Metadata returned from storage</returns> private static async Task <ResultFromStorage> GetFromStorageAsync(string key) { //- Check Manager CheckIfAvailable(); //- Get Value ResultFromStorage result = new ResultFromStorage() { HasResult = false, }; CloudBlockBlob blob = _instance._blobContainer.GetBlockBlobReference(key); result.SerializedResult = await blob.DownloadTextAsync(); result.HasResult = true; return(result); }
/// <summary> /// Gets the contribution metadata that is stored within Azure storage using the hyperlink ID as the key; returns null when not found /// </summary> /// <param name="hyperlinkID">Unique identifier of the storage blob result; key used to locate the results in storage</param> /// <returns>Contribution data from storage; NULL when not found</returns> public static async Task <ResultStorage> GetContributionResultAsync(string hyperlinkID) { //- Check Parameters if (string.IsNullOrEmpty(hyperlinkID) == true) { throw new ArgumentNullException("hyperlinkID"); } //- Get Value ResultFromStorage storageResult = await GetFromStorageAsync(GetContributionBlobKey(hyperlinkID)); //- Deserialize Result ResultStorage result = null; if (storageResult.HasResult == true) { result = JsonConvert.DeserializeObject <ResultStorage>(storageResult.SerializedResult); } return(result); }