Clover.NET coverage report - Coverage

Coverage timestamp: Friday, May 20, 2005 9:17:00 PM

File Stats: LOC: 93   Methods: 7
NCLOC: 50 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
TypeHandlers\CustomTypeHandler.cs - 45.5 % 42.9 % 44.4 %
coverage coverage
1   #region Apache Notice
2   /*****************************************************************************
3   * $Header: $
4   * $Revision: $
5   * $Date: $
6   *
7   * iBATIS.NET Data Mapper
8   * Copyright (C) 2004 - Gilles Bayon
9   *
10   *
11   * Licensed under the Apache License, Version 2.0 (the "License");
12   * you may not use this file except in compliance with the License.
13   * You may obtain a copy of the License at
14   *
15   * http://www.apache.org/licenses/LICENSE-2.0
16   *
17   * Unless required by applicable law or agreed to in writing, software
18   * distributed under the License is distributed on an "AS IS" BASIS,
19   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   * See the License for the specific language governing permissions and
21   * limitations under the License.
22   *
23   ********************************************************************************/
24   #endregion
25  
26   #region Using
27  
28   using System;
29   using System.Data;
30   using IBatisNet.DataMapper.Configuration.ParameterMapping;
31   using IBatisNet.DataMapper.Configuration.ResultMapping;
32   #endregion
33  
34   namespace IBatisNet.DataMapper.TypeHandlers
35   {
36   /// <summary>
37   /// Custom type handler for adding a TypeHandlerCallback
38   /// </summary>
39   internal class CustomTypeHandler : BaseTypeHandler
40   {
41   private ITypeHandlerCallback _callback = null;
42  
43 1020 public CustomTypeHandler(ITypeHandlerCallback callback)
44   {
45 1020 _callback = callback;
46   }
47  
48   /// <summary>
49   /// Performs processing on a value before it is used to set
50   /// the parameter of a IDbCommand.
51   /// </summary>
52   /// <param name="dataParameter"></param>
53   /// <param name="parameterValue">The value to be set</param>
54   /// <param name="dbType">Data base type</param>
55 35 public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
56   {
57 35 IParameterSetter setter = new ParameterSetterImpl(dataParameter);
58 35 _callback.SetParameter(setter, parameterValue);
59   }
60  
61 224 public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
62   {
63 224 IResultGetter getter = new ResultGetterImpl(dataReader, mapping.ColumnName);
64 224 return _callback.GetResult(getter);
65   }
66  
67 0 public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
68   {
69   IResultGetter getter = new ResultGetterImpl(dataReader, mapping.ColumnIndex);
70   return _callback.GetResult(getter);
71   }
72  
73 0 public override object ValueOf(Type type, string s)
74   {
75   return _callback.ValueOf(s);
76   }
77  
78 0 public override object GetDataBaseValue(object outputValue, Type parameterType)
79   {
80   IResultGetter getter = new ResultGetterImpl(outputValue);
81   return _callback.GetResult(getter);
82   }
83  
84 0 public override bool IsSimpleType
85   {
86   get
87   {
88   return true;
89   }
90   }
91   }
92   }
93