33using Ydb . Sdk . Client ;
44using Ydb . Table ;
55
6- namespace Ydb . Sdk . Services . Table
6+ namespace Ydb . Sdk . Services . Table ;
7+
8+ public static class BulkUpsertExtensions
79{
8- public static class BulkUpsertExtensions
10+ public static async Task < IResponse > BulkUpsertWithRetry < T > (
11+ this TableClient tableClient ,
12+ string tablePath ,
13+ IReadOnlyCollection < T > rows ,
14+ RetrySettings ? retrySettings = null )
915 {
10- public static async Task < IResponse > BulkUpsertWithRetry < T > (
11- this TableClient tableClient ,
12- string tablePath ,
13- IReadOnlyCollection < T > rows ,
14- RetrySettings ? retrySettings = null )
15- {
16- return await tableClient . SessionExec (
17- async session =>
16+ return await tableClient . SessionExec (
17+ async session =>
18+ {
19+ var req = new BulkUpsertRequest
1820 {
19- var req = new BulkUpsertRequest
20- {
21- Table = tablePath ,
22- OperationParams = new OperationParams ( ) ,
23- Rows = TypedValueFactory . FromObjects ( rows )
24- } ;
25- var resp = await session . BulkUpsertAsync ( req ) ;
26- return new BulkUpsertResponseAdapter ( resp ) ;
27- } ,
28- retrySettings
29- ) ;
30- }
21+ Table = tablePath ,
22+ OperationParams = new OperationParams ( ) ,
23+ Rows = TypedValueFactory . FromObjects ( rows )
24+ } ;
25+ var resp = await session . BulkUpsertAsync ( req ) ;
26+ return new BulkUpsertResponseAdapter ( resp ) ;
27+ } ,
28+ retrySettings
29+ ) ;
3130 }
3231}
0 commit comments