private async Task <TableResponse> ExecutecInternalAsyn(TableCredentials credentials, TableStorageUri storageUri) { var time = DateTimeOffset.UtcNow.UtcDateTime.ToString("R", CultureInfo.InvariantCulture); using (var request = new HttpRequestMessage(HttpMethod, storageUri.BuildRequestUri(_tableUri))) { request.Headers.Add("x-ms-date", time); request.Headers.Authorization = credentials.AuthorizationHeader(time, _tableUri.Url); if (_operationType == TableOperationType.Insert || _operationType == TableOperationType.InsertEdmType || _operationType == TableOperationType.Update) { request.Headers.Add("Prefer", TableConstants.ReturnNoContent); request.Content = _entity.Serialize(GetEntity()); } if (_operationType == TableOperationType.Update || _operationType == TableOperationType.Delete) { request.Headers.Add("If-Match", "*"); } using (var cts = new CancellationTokenSource(TableConstants.DefaultRequestTimeout)) { using (var response = await HttpClientFactory.Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cts.Token).ConfigureAwait(false)) { using (var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) { if (!response.IsSuccessStatusCode) { ThrowHelper.Throw(await stream.StringAsync(), response.StatusCode); } if (_operationType == TableOperationType.Get) { return(new TableResponse(await stream.CopyAsync(), response.StatusCode, response.Headers)); } return(new TableResponse(response.StatusCode)); } } } } }