Rev | Line | |
---|
[2904] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using AopAlliance.Intercept;
|
---|
| 6 | using System.Threading;
|
---|
[3011] | 7 | using HeuristicLab.Hive.Server.LINQDataAccess;
|
---|
| 8 | using System.Transactions;
|
---|
[2904] | 9 |
|
---|
| 10 | namespace 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);
|
---|
[3011] | 16 |
|
---|
| 17 | Object obj;
|
---|
| 18 |
|
---|
[3013] | 19 | // using (TransactionScope scope = new TransactionScope()) {
|
---|
[3011] | 20 | try {
|
---|
| 21 | obj = invocation.Proceed();
|
---|
[3013] | 22 | // scope.Complete();
|
---|
[3011] | 23 | } finally {
|
---|
| 24 | ContextFactory.Context.Dispose();
|
---|
| 25 | Console.WriteLine("setting old context null");
|
---|
| 26 | ContextFactory.Context = null;
|
---|
| 27 | Console.WriteLine("Disposing old Context");
|
---|
| 28 | }
|
---|
[3013] | 29 | // }
|
---|
[3011] | 30 | Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Leaving Method " + invocation.Method.Name);
|
---|
[2904] | 31 | return obj;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | #endregion
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.