本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.ExistsAsync方法的典型用法代码示例。如果您正苦于以下问题:C# CloudBlockBlob.ExistsAsync方法的具体用法?C# CloudBlockBlob.ExistsAsync怎么用?C# CloudBlockBlob.ExistsAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob
的用法示例。
在下文中一共展示了CloudBlockBlob.ExistsAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckForUpdateAsync
private async Task CheckForUpdateAsync()
{
var storageAccount = CloudStorageAccount.Parse(_configuration.ReferenceDataStorageAccount);
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(_configuration.ReferenceDataStorageContainer);
_blockBlob = container.GetBlockBlobReference(_configuration.ReferenceDataFilePath);
if(!await _blockBlob.ExistsAsync())
{
throw new ApplicationException(string.Format(CultureInfo.InvariantCulture,
"Could not find blob named {0}.",
_configuration.ReferenceDataFilePath));
}
await _blockBlob.FetchAttributesAsync();
if (_blockBlob.Properties.ETag == _blobETag)
{
return;
}
await LoadDictionaryAsync();
_blobETag = _blockBlob.Properties.ETag;
}
示例2: GetSnapshotStateForVm
private async Task<SnapshotState> GetSnapshotStateForVm(VirtualMachine vm)
{
var snapshotStateUri = vm.StorageProfile.OSDisk.VirtualHardDisk.Uri + ".snapshotstate";
var storageCred = await GetStorageCredentialsForUri(snapshotStateUri);
var blob = new CloudBlockBlob(new Uri(snapshotStateUri), storageCred);
var snapshotState = new SnapshotState();
if (await blob.ExistsAsync())
{
snapshotState = JsonConvert.DeserializeObject<SnapshotState>(await blob.DownloadTextAsync());
}
return snapshotState;
}
示例3: BlobIsExists
private static async Task BlobIsExists(CloudBlockBlob blob, string fileId)
{
bool blobIsExist = await blob.ExistsAsync();
if (!blobIsExist)
{
throw new NotFoundException(String.Format("File with id {0} does not exist.", fileId));
}
}