Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.DataAccess/3.3/TransactionManager.cs @ 4649

Last change on this file since 4649 was 4649, checked in by cneumuel, 13 years ago
  • moved db-context into datalayer
  • businesslayer only defines the transaction-scope
  • removed contextfactory
  • implemented convert-methods
  • made naming in db and domainobjects more consistent
  • changed wcf-service to be http-only (for now)

(#1233)

File size: 841 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Services.Hive.Common;
6using System.Transactions;
7using HeuristicLab.Common;
8
9namespace HeuristicLab.Services.Hive.DataAccess {
10  public class TransactionManager {
11    public Disposable<TransactionScope> OpenTransaction() {
12      TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE });
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.