Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/BaseDao.cs @ 3578

Last change on this file since 3578 was 3578, checked in by kgrading, 14 years ago

Removed References to HiveLogging and updated the default logging mechanism (#991)

File size: 962 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Data.Linq;
6using HeuristicLab.Tracing;
7
8namespace HeuristicLab.Hive.Server.LINQDataAccess {
9  public abstract class BaseDao<TBusiness, TDatabaseEntity> {
10    public static HiveDataContext Context {
11      get {
12        return ContextFactory.Context;
13      }
14    }
15
16    protected void CommitChanges() {
17      try {
18        Context.SubmitChanges(ConflictMode.ContinueOnConflict);
19      } catch (ChangeConflictException e) {
20        Logger.Warn("Concurrency Exception! " + e.Message);
21        foreach (ObjectChangeConflict conflict in Context.ChangeConflicts) {         
22          conflict.Resolve(RefreshMode.KeepChanges);
23        }
24      }
25    }
26
27    public abstract TDatabaseEntity DtoToEntity(TBusiness source, TDatabaseEntity target);
28    public abstract TBusiness EntityToDto(TDatabaseEntity source, TBusiness target);
29
30  }
31}
Note: See TracBrowser for help on using the repository browser.