Exemplo n.º 1
0
 /// <summary>
 /// Puts the lease on the given container in a released state.
 /// </summary>
 /// <param name="container">The container with the lease.</param>
 /// <param name="leaseTime">The amount of time on the released lease.</param>
 /// <returns>The lease ID of the released lease.</returns>
 internal static string SetReleasedStateAPM(CloudBlobContainer container, TimeSpan? leaseTime)
 {
     string leaseId = SetLeasedStateAPM(container, leaseTime);
     using (AutoResetEvent waitHandle = new AutoResetEvent(false))
     {
         IAsyncResult result = container.BeginReleaseLease(AccessCondition.GenerateLeaseCondition(leaseId), ar => waitHandle.Set(), null);
         waitHandle.WaitOne();
         container.EndReleaseLease(result);
         return leaseId;
     }
 }