| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Configuration\Alias\TypeHandler.cs | - | 87.5 % | 88.9 % | 88.2 % |
|
1 | ||
2 | #region Apache Notice | |
3 | /***************************************************************************** | |
4 | * $Header: $ | |
5 | * $Revision: $ | |
6 | * $Date: $ | |
7 | * | |
8 | * iBATIS.NET Data Mapper | |
9 | * Copyright (C) 2004 - Gilles Bayon | |
10 | * | |
11 | * | |
12 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
13 | * you may not use this file except in compliance with the License. | |
14 | * You may obtain a copy of the License at | |
15 | * | |
16 | * http://www.apache.org/licenses/LICENSE-2.0 | |
17 | * | |
18 | * Unless required by applicable law or agreed to in writing, software | |
19 | * distributed under the License is distributed on an "AS IS" BASIS, | |
20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
21 | * See the License for the specific language governing permissions and | |
22 | * limitations under the License. | |
23 | * | |
24 | ********************************************************************************/ | |
25 | #endregion | |
26 | ||
27 | #region Using | |
28 | ||
29 | using System; | |
30 | using System.Xml.Serialization; | |
31 | using IBatisNet.Common.Utilities; | |
32 | ||
33 | #endregion | |
34 | ||
35 | namespace IBatisNet.DataMapper.Configuration.Alias | |
36 | { | |
37 | /// <summary> | |
38 | /// Summary description for TypeHandler. | |
39 | /// </summary> | |
40 | [Serializable] | |
41 | [XmlRoot("typeHandler")] | |
42 | public class TypeHandler | |
43 | { | |
44 | #region Fields | |
45 | [NonSerialized] | |
46 | private string _className = string.Empty; | |
47 | [NonSerialized] | |
48 | private Type _class = null; | |
49 | [NonSerialized] | |
50 | private string _dbType = string.Empty; | |
51 | [NonSerialized] | |
52 | private string _callBackName = string.Empty; | |
53 | #endregion | |
54 | ||
55 | #region Properties | |
56 | /// <summary> | |
57 | /// CLR type | |
58 | /// </summary> | |
59 | [XmlAttribute("type")] | |
60 | public string ClassName | |
61 | { | |
62 | 680 | get { return _className; } |
63 | 170 | set {_className = value; } |
64 | } | |
65 | ||
66 | /// <summary> | |
67 | /// The type class for the TypeName | |
68 | /// </summary> | |
69 | 0 | [XmlIgnore] |
70 | public Type Class | |
71 | { | |
72 | get { return _class; } | |
73 | } | |
74 | ||
75 | /// <summary> | |
76 | /// dbType name | |
77 | /// </summary> | |
78 | [XmlAttribute("dbType")] | |
79 | public string DbType | |
80 | { | |
81 | 680 | get { return _dbType; } |
82 | 170 | set {_dbType = value; } |
83 | } | |
84 | ||
85 | ||
86 | /// <summary> | |
87 | /// callback alias name | |
88 | /// </summary> | |
89 | [XmlAttribute("callback")] | |
90 | public string CallBackName | |
91 | { | |
92 | 170 | get { return _callBackName; } |
93 | 170 | set {_callBackName = value; } |
94 | } | |
95 | ||
96 | ||
97 | #endregion | |
98 | ||
99 | #region Constructors | |
100 | ||
101 | /// <summary> | |
102 | /// Do not use direclty, only for serialization. | |
103 | /// </summary> | |
104 | 170 | [Obsolete("This public constructor with no parameter is not really obsolete, but is reserved for serialization.", false)] |
105 | public TypeHandler() | |
106 | {} | |
107 | #endregion | |
108 | ||
109 | ||
110 | #region Methods | |
111 | /// <summary> | |
112 | /// Initialize the object, | |
113 | /// try to idenfify the .Net type class from the corresponding name. | |
114 | /// </summary> | |
115 | 170 | public void Initialize() |
116 | { | |
117 | 170 | _class = Resources.TypeForName(_className); |
118 | } | |
119 | #endregion | |
120 | ||
121 | } | |
122 | } | |
123 |
|