本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DeleteIfExists方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudBlockBlob.DeleteIfExists方法的具體用法?C# CloudBlockBlob.DeleteIfExists怎麽用?C# CloudBlockBlob.DeleteIfExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob
的用法示例。
在下文中一共展示了CloudBlockBlob.DeleteIfExists方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DeleteBackup
private void DeleteBackup(CloudBlockBlob blob)
{
Log.Info("Deleting Blob: {0}", blob.Uri.AbsoluteUri);
if (!WhatIf)
{
blob.DeleteIfExists(DeleteSnapshotsOption.IncludeSnapshots, accessCondition: AccessCondition.GenerateIfMatchCondition(blob.Properties.ETag));
}
}
示例2: OnExecuting
protected override void OnExecuting(CloudBlockBlob workItem)
{
if (workItem == null)
throw new ArgumentNullException("workItem");
workItem.DeleteIfExists();
string message = string.Format(CultureInfo.InvariantCulture, Resources.SnapshotCleaner_Deleted_Snapshot_Confirmation, workItem.Uri, workItem.SnapshotTime);
Report(message);
}
示例3: DeleteIfExists
private static void DeleteIfExists(CloudBlockBlob blob)
{
try
{
blob.DeleteIfExists();
}
catch (StorageException e)
{
throw new BlobException(string.Format(CultureInfo.InvariantCulture, "Could not DeleteIfExists blob named '{0}' from container. See inner exception for details.", blob.Name), e);
}
}
示例4: DeleteBlob
private static void DeleteBlob(CloudBlockBlob blockBlob)
{
int attempt = 0;
int MaxAttempts = 3;
while (++attempt <= MaxAttempts)
{
try
{
blockBlob.DeleteIfExists();
break;
}
catch (Exception ex)
{
if (attempt == MaxAttempts)
{
throw ex;
}
Thread.Sleep(100);
}
}
}
示例5: DeleteBlob
private static void DeleteBlob(string packageUrl, string storageAccountName, string storageAccountKey)
{
OurTrace.TraceInfo(string.Format("Deleting blob {0}", packageUrl));
var packageUri = new Uri(packageUrl);
var credentials = new StorageCredentials(storageAccountName, storageAccountKey);
var blobRef = new CloudBlockBlob(packageUri, credentials);
blobRef.DeleteIfExists();
}