Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server/3.2/ServiceCallInterception.cs @ 3011

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

changed the complete DAL to LINQ 2 SQL (with the exception of the job streaming), did a lot of refactoring, Introduced DTOs (that are named DTOs for better understanding), added the spring.NET Interceptor, reintroduced transactions and cleaned up the whole JobResult thing and updated a part of the config merger (#830)

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using AopAlliance.Intercept;
6using System.Threading;
7using HeuristicLab.Hive.Server.LINQDataAccess;
8using System.Transactions;
9
10namespace HeuristicLab.Hive.Server {
11  class ServiceCallInterception: IMethodInterceptor {
12    #region IMethodInterceptor Members
13
14    public object Invoke(IMethodInvocation invocation) {
15      Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Entering Method " + invocation.Method.Name);
16
17      Object obj;
18     
19      using (TransactionScope scope = new TransactionScope()) {
20        try {
21          obj = invocation.Proceed();
22          scope.Complete();
23        } finally {
24          ContextFactory.Context.Dispose();
25          Console.WriteLine("setting old context null");
26          ContextFactory.Context = null;
27          Console.WriteLine("Disposing old Context");     
28        }
29      }     
30      Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Leaving Method " + invocation.Method.Name);           
31      return obj;
32    }
33
34    #endregion
35  }
36}
Note: See TracBrowser for help on using the repository browser.