/// <summary> /// Puts the lease on the given blob in a leased state. /// </summary> /// <param name="blob">The blob with the lease.</param> /// <param name="leaseTime">The amount of time on the new lease.</param> /// <returns>The lease ID of the current lease.</returns> internal static async Task<string> SetLeasedStateAsync(CloudBlob blob, TimeSpan? leaseTime) { string leaseId = Guid.NewGuid().ToString(); await SetAvailableStateAsync(blob); return await blob.AcquireLeaseAsync(leaseTime, leaseId); }
/// <summary> /// Puts the lease on the given blob in a leased state. /// </summary> /// <param name="blob">The blob with the lease.</param> /// <param name="leaseTime">The amount of time on the new lease.</param> /// <returns>The lease ID of the current lease.</returns> internal static string SetLeasedStateTask(CloudBlob blob, TimeSpan? leaseTime) { string leaseId = Guid.NewGuid().ToString(); SetAvailableStateTask(blob); return blob.AcquireLeaseAsync(leaseTime, leaseId).Result; }