Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Services.Hive.Common;
|
---|
6 | using System.Transactions;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Services.Hive.DataAccess {
|
---|
10 | public class TransactionManager {
|
---|
11 | public Disposable<TransactionScope> OpenTransaction() {
|
---|
12 | TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.IsolationLevelScope });
|
---|
13 | var disposable = new Disposable<TransactionScope>(transaction);
|
---|
14 | disposable.Disposing += disposable_Disposing;
|
---|
15 | return disposable;
|
---|
16 | }
|
---|
17 |
|
---|
18 | void disposable_Disposing(object sender, EventArgs<TransactionScope> scope) {
|
---|
19 | scope.Value.Complete();
|
---|
20 | scope.Value.Dispose();
|
---|
21 | }
|
---|
22 | }
|
---|
23 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.