| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Scope\RequestScope.cs | - | 90.9 % | 90.9 % | 90.9 % |
|
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.Collections; | |
30 | using System.Data; | |
31 | using IBatisNet.DataMapper.Configuration.ParameterMapping; | |
32 | using IBatisNet.DataMapper.Configuration.ResultMapping; | |
33 | using IBatisNet.DataMapper.Configuration.Statements; | |
34 | ||
35 | #endregion | |
36 | ||
37 | namespace IBatisNet.DataMapper.Scope | |
38 | { | |
39 | /// <summary> | |
40 | /// Hold data during the process of a mapped statement. | |
41 | /// </summary> | |
42 | public class RequestScope | |
43 | { | |
44 | #region Fields | |
45 | ||
46 | private ErrorContext _errorContext = null; | |
47 | private ParameterMap _parameterMap = null; | |
48 | private ResultMap _resultMap = null; | |
49 | private PreparedStatement _preparedStatement = null; | |
50 | private Queue _properties = new Queue(); | |
51 | ||
52 | #endregion | |
53 | ||
54 | #region Constructors | |
55 | ||
56 | /// <summary> | |
57 | /// Default constructor | |
58 | /// </summary> | |
59 | 20709 | public RequestScope() |
60 | { | |
61 | 20709 | _errorContext = new ErrorContext(); |
62 | } | |
63 | #endregion | |
64 | ||
65 | #region Properties | |
66 | ||
67 | /// <summary> | |
68 | /// Get the request's error context | |
69 | /// </summary> | |
70 | public ErrorContext ErrorContext | |
71 | { | |
72 | 49 | get |
73 | { | |
74 | 49 | return _errorContext; |
75 | } | |
76 | } | |
77 | ||
78 | /// <summary> | |
79 | /// The 'select' result property to process after having process the main properties. | |
80 | /// </summary> | |
81 | public Queue QueueSelect | |
82 | { | |
83 | 327 | get { return _properties; } |
84 | 0 | set { _properties = value; } |
85 | } | |
86 | ||
87 | /// <summary> | |
88 | /// The ResultMap used by this request. | |
89 | /// </summary> | |
90 | public ResultMap ResultMap | |
91 | { | |
92 | 454 | get { return _resultMap; } |
93 | 309 | set { _resultMap = value; } |
94 | } | |
95 | ||
96 | /// <summary> | |
97 | /// The parameterMap used by this request. | |
98 | /// </summary> | |
99 | public ParameterMap ParameterMap | |
100 | { | |
101 | 72432 | get { return _parameterMap; } |
102 | 20709 | set { _parameterMap = value; } |
103 | } | |
104 | ||
105 | /// <summary> | |
106 | /// The PreparedStatement used by this request. | |
107 | /// </summary> | |
108 | public PreparedStatement PreparedStatement | |
109 | { | |
110 | 916 | get { return _preparedStatement; } |
111 | 309 | set { _preparedStatement = value; } |
112 | } | |
113 | #endregion | |
114 | ||
115 | #region Method | |
116 | ||
117 | ||
118 | /// <summary> | |
119 | /// Check if the ResultMap is well set, process case of subMap resultMap. | |
120 | /// </summary> | |
121 | /// <param name="dataReader">The current IDataReader</param> | |
122 | /// <returns>the resultMap to use</returns> | |
123 | 232 | public ResultMap GetResultMap(IDataReader dataReader) |
124 | { | |
125 | 232 | return _resultMap.ResolveSubMap(dataReader); |
126 | } | |
127 | ||
128 | #endregion | |
129 | } | |
130 | } | |
131 |
|