Changeset 2123 for trunk/sources
- Timestamp:
- 06/28/09 16:15:10 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Session.cs
r2117 r2123 84 84 } 85 85 86 public ITransaction BeginTransaction( ) {86 public ITransaction BeginTransaction(TransactionIsolationLevel isolationLevel) { 87 87 CheckThread(); 88 88 89 89 if (transaction == null) { 90 transaction = new Transaction(this);91 90 transaction = new Transaction(this, isolationLevel); 91 transaction.Connection = Connection; 92 92 } 93 93 … … 95 95 96 96 return transaction; 97 } 98 99 public ITransaction BeginTransaction() { 100 return BeginTransaction(TransactionIsolationLevel.Default); 97 101 } 98 102 -
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Transaction.cs
r2117 r2123 36 36 private int usageCounter = 0; 37 37 38 public Transaction(Session session) { 38 private TransactionIsolationLevel isolationLevel; 39 40 public Transaction(Session session, TransactionIsolationLevel isolationLevel) { 39 41 this.session = session; 42 this.isolationLevel = isolationLevel; 40 43 } 41 44 … … 53 56 value.Open(); 54 57 55 transaction = value.BeginTransaction(IsolationLevel.ReadCommitted); 58 if (isolationLevel == TransactionIsolationLevel.Default) 59 transaction = value.BeginTransaction(IsolationLevel.ReadCommitted); 60 else if (isolationLevel == TransactionIsolationLevel.ReadUncommitted) 61 transaction = value.BeginTransaction(IsolationLevel.ReadUncommitted); 62 else if (isolationLevel == TransactionIsolationLevel.ReadCommitted) 63 transaction = value.BeginTransaction(IsolationLevel.ReadCommitted); 64 else if (isolationLevel == TransactionIsolationLevel.RepeatableRead) 65 transaction = value.BeginTransaction(IsolationLevel.RepeatableRead); 66 else if (isolationLevel == TransactionIsolationLevel.Serializable) 67 transaction = value.BeginTransaction(IsolationLevel.Serializable); 68 else 69 transaction = value.BeginTransaction(IsolationLevel.ReadCommitted); 56 70 } 57 71 } -
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/VarBinaryStream.cs
r2117 r2123 168 168 } else { 169 169 _ownedConnection = false; 170 _ownedTransaction = false;171 170 172 171 if (transaction != null) { 173 172 _transaction = transaction; 173 174 _ownedTransaction = false; 175 176 if (_transaction.IsolationLevel != IsolationLevel.RepeatableRead && 177 _transaction.IsolationLevel != IsolationLevel.Serializable) { 178 throw new ArgumentException("Transaction level must be at least repeatable read"); 179 } 180 } else { 181 _transaction = 182 _connection.BeginTransaction( 183 IsolationLevel.RepeatableRead) 184 as SqlTransaction; 185 186 _ownedTransaction = true; 174 187 } 175 188 } -
trunk/sources/HeuristicLab.DataAccess/3.2/Interfaces/ISession.cs
r2117 r2123 25 25 26 26 namespace HeuristicLab.DataAccess.Interfaces { 27 public enum TransactionIsolationLevel { 28 Default, ReadUncommitted, ReadCommitted, RepeatableRead, Serializable 29 }; 30 27 31 public interface ISession { 28 32 ISessionFactory Factory { get; } 29 33 34 ITransaction BeginTransaction(TransactionIsolationLevel isolationLevel); 35 30 36 ITransaction BeginTransaction(); 31 37 -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r2122 r2123 480 480 (JobResult)formatter.Deserialize(stream); 481 481 482 tx = session.BeginTransaction(); 482 //important - repeatable read isolation level is required here, 483 //otherwise race conditions could occur when writing the stream into the DB 484 tx = session.BeginTransaction( 485 TransactionIsolationLevel.RepeatableRead); 483 486 484 487 ResponseResultReceived response =
Note: See TracChangeset
for help on using the changeset viewer.