File tree Expand file tree Collapse file tree
src/EFCore.Cassandra/Update/Internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Copyright (c) SimpleIdServer. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+ using Cassandra . Data ;
34using Microsoft . EntityFrameworkCore . Infrastructure ;
45using Microsoft . EntityFrameworkCore . Storage ;
56using Microsoft . EntityFrameworkCore . Update ;
@@ -87,39 +88,18 @@ private async Task<int> ExecuteAsync(
8788 var commandBatches = parameters . Item1 ;
8889 var connection = parameters . Item2 ;
8990 var rowsAffected = 0 ;
90- IDbContextTransaction startedTransaction = null ;
9191 try
9292 {
93- if ( connection . CurrentTransaction == null
94- && ( connection as ITransactionEnlistmentManager ) ? . EnlistedTransaction == null
95- && Transaction . Current == null
96- && CurrentContext . Context . Database . AutoTransactionsEnabled )
97- {
98- startedTransaction = await connection . BeginTransactionAsync ( cancellationToken ) ;
99- }
100- else
101- {
102- await connection . OpenAsync ( cancellationToken ) ;
103- }
104-
93+ await connection . OpenAsync ( cancellationToken ) ;
10594 foreach ( var batch in commandBatches )
10695 {
10796 await batch . ExecuteAsync ( connection , cancellationToken ) ;
10897 rowsAffected += batch . ModificationCommands . Count ;
10998 }
110-
111- startedTransaction ? . Commit ( ) ;
11299 }
113100 finally
114101 {
115- if ( startedTransaction != null )
116- {
117- startedTransaction . Dispose ( ) ;
118- }
119- else
120- {
121- connection . Close ( ) ;
122- }
102+ connection . Close ( ) ;
123103 }
124104
125105 return rowsAffected ;
You can’t perform that action at this time.
0 commit comments