Clover.NET coverage report - Coverage for s2container.net

Coverage timestamp: 2006年5月30日 11:21:29

File Stats: LOC: 71   Methods: 2
NCLOC: 47 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Extension.Tx\Impl\LocalRequiredTxHandler.cs 75.0% 100.0% 100.0% 95.7%
coverage coverage
1   #region Copyright
2   /*
3   * Copyright 2005 the Seasar Foundation and the Others.
4   *
5   * Licensed under the Apache License, Version 2.0 (the "License");
6   * you may not use this file except in compliance with the License.
7   * You may obtain a copy of the License at
8   *
9   * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14   * either express or implied. See the License for the specific language
15   * governing permissions and limitations under the License.
16   */
17   #endregion
18  
19   using System;
20  
21   using Seasar.Framework.Aop;
22  
23   namespace Seasar.Extension.Tx.Impl
24   {
25   /// <summary>
26   /// LocalRequiredTxHandler の概要の説明です。
27   /// </summary>
28   public class LocalRequiredTxHandler : AbstractLocalTxHandler
29   {
30 6 public override object Handle(IMethodInvocation invocation, bool alreadyInTransaction)
31   {
32 6 if(! alreadyInTransaction)
33   {
34 2 return HandleTransaction(invocation);
35   }
36   else
37   {
38 4 return invocation.Proceed();
39   }
40   }
41  
42 2 private object HandleTransaction(IMethodInvocation invocation)
43   {
44 2 using(ITransactionContext current = this.Context.Create())
45   {
46 2 ITransactionContext parent = this.Context.Current;
47 2 current.Parent = parent;
48 2 current.Begin();
49 2 this.Context.Current = current;
50 2 try
51   {
52 2 object obj = invocation.Proceed();
53 1 current.Commit();
54 1 return obj;
55   }
56   catch
57   {
58 1 current.Rollback();
59 1 throw;
60   }
61   finally
62   {
63 2 this.Context.Current = parent;
64 2 if(parent != null) this.Context.Current.Parent = null;
65   }
66   }
67   }
68  
69   }
70   }
71