Skip to content

Commit 43fa107

Browse files
authored
Improved the performance of TableServiceClient.GetTableClient() (Azure#47406)
1 parent f2cc51a commit 43fa107

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sdk/tables/Azure.Data.Tables/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### Bugs Fixed
1212

1313
### Other Changes
14+
- Improved the performance of `TableServiceClient.GetTableClient()`
1415

1516
## 12.9.1 (2024-09-17)
1617

sdk/tables/Azure.Data.Tables/src/TableClient.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public TableClient(string connectionString, string tableName, TableClientOptions
234234
_version = options.VersionString;
235235
_diagnostics = new ClientDiagnostics(options);
236236
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
237-
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
237+
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
238238
Name = tableName;
239239
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
240240
}
@@ -286,7 +286,7 @@ public TableClient(Uri endpoint, string tableName, TokenCredential tokenCredenti
286286
_version = options.VersionString;
287287
_diagnostics = new ClientDiagnostics(options);
288288
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
289-
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
289+
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
290290
Name = tableName;
291291
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
292292
}
@@ -337,7 +337,7 @@ null when string.IsNullOrWhiteSpace(_endpoint.Query) => policy,
337337
_version = options.VersionString;
338338
_diagnostics = new ClientDiagnostics(options);
339339
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
340-
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
340+
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
341341
Name = tableName;
342342
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
343343
}
@@ -363,7 +363,7 @@ internal TableClient(
363363
{
364364
_tableOperations = tableOperations;
365365
}
366-
_batchOperations = new TableRestClient(diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
366+
_batchOperations = new TableRestClient(diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
367367
_version = version;
368368
Name = table;
369369
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
@@ -1743,6 +1743,8 @@ private HttpMessage CreateUpdateOrMergeRequest(TableRestClient batchOperations,
17431743
return msg;
17441744
}
17451745

1746+
private static readonly HttpPipeline _batchPipeline = CreateBatchPipeline();
1747+
17461748
/// <summary>
17471749
/// Creates a pipeline to use for processing sub-operations before they are combined into a single multipart request.
17481750
/// </summary>

0 commit comments

Comments
 (0)