1
1
using System ;
2
+ using System . Collections ;
2
3
using System . Data ;
3
4
using System . Data . Common ;
4
5
@@ -12,7 +13,7 @@ namespace NHibernate.AdoNet
12
13
/// <seealso cref="IDataRecord.GetOrdinal"/>
13
14
public class ResultSetWrapper : DbDataReader
14
15
{
15
- private readonly DbDataReader rs ;
16
+ private DbDataReader rs ;
16
17
private readonly ColumnNameCache columnNameCache ;
17
18
18
19
public ResultSetWrapper ( DbDataReader resultSet , ColumnNameCache columnNameCache )
@@ -26,206 +27,192 @@ internal DbDataReader Target
26
27
get { return rs ; }
27
28
}
28
29
29
- #region DbDataReader Members
30
-
31
- public void Close ( )
30
+ public override void Close ( )
32
31
{
33
32
rs . Close ( ) ;
34
33
}
35
34
36
- public DataTable GetSchemaTable ( )
35
+ public override DataTable GetSchemaTable ( )
37
36
{
38
37
return rs . GetSchemaTable ( ) ;
39
38
}
40
39
41
- public bool NextResult ( )
40
+ public override bool NextResult ( )
42
41
{
43
42
return rs . NextResult ( ) ;
44
43
}
45
44
46
- public bool Read ( )
45
+ public override bool Read ( )
47
46
{
48
47
return rs . Read ( ) ;
49
48
}
50
49
51
- public int Depth
50
+ public override int Depth
52
51
{
53
52
get { return rs . Depth ; }
54
53
}
55
54
56
- public bool IsClosed
55
+ public override bool HasRows
57
56
{
58
- get { return rs . IsClosed ; }
57
+ get { return rs . HasRows ; }
59
58
}
60
59
61
- public int RecordsAffected
60
+ public override bool IsClosed
62
61
{
63
- get { return rs . RecordsAffected ; }
62
+ get { return rs . IsClosed ; }
64
63
}
65
64
66
- #endregion
67
-
68
- #region IDisposable Members
69
- private bool disposed ;
70
-
71
- ~ ResultSetWrapper ( )
65
+ public override int RecordsAffected
72
66
{
73
- Dispose ( false ) ;
67
+ get { return rs . RecordsAffected ; }
74
68
}
75
69
76
- public void Dispose ( )
77
- {
78
- Dispose ( true ) ;
79
- GC . SuppressFinalize ( this ) ;
80
- }
70
+ private bool disposed ;
81
71
82
- private void Dispose ( bool disposing )
72
+ protected override void Dispose ( bool disposing )
83
73
{
84
74
if ( disposed )
85
75
return ;
86
76
87
- if ( disposing )
77
+ if ( disposing && rs != null )
88
78
{
89
- if ( rs != null )
90
- {
91
- if ( ! rs . IsClosed ) rs . Close ( ) ;
92
79
rs . Dispose ( ) ;
80
+ rs = null ;
93
81
}
94
- }
95
82
96
83
disposed = true ;
97
84
}
98
- #endregion
99
-
100
- #region IDataRecord Members
101
85
102
- public string GetName ( int i )
86
+ public override string GetName ( int i )
103
87
{
104
88
return rs . GetName ( i ) ;
105
89
}
106
90
107
- public string GetDataTypeName ( int i )
91
+ public override string GetDataTypeName ( int i )
108
92
{
109
93
return rs . GetDataTypeName ( i ) ;
110
94
}
111
95
112
- public System . Type GetFieldType ( int i )
96
+ public override IEnumerator GetEnumerator ( )
97
+ {
98
+ return rs . GetEnumerator ( ) ;
99
+ }
100
+
101
+ public override System . Type GetFieldType ( int i )
113
102
{
114
103
return rs . GetFieldType ( i ) ;
115
104
}
116
105
117
- public object GetValue ( int i )
106
+ public override object GetValue ( int i )
118
107
{
119
108
return rs . GetValue ( i ) ;
120
109
}
121
110
122
- public int GetValues ( object [ ] values )
111
+ public override int GetValues ( object [ ] values )
123
112
{
124
113
return rs . GetValues ( values ) ;
125
114
}
126
115
127
- public int GetOrdinal ( string name )
116
+ public override int GetOrdinal ( string name )
128
117
{
129
118
return columnNameCache . GetIndexForColumnName ( name , this ) ;
130
119
}
131
120
132
- public bool GetBoolean ( int i )
121
+ public override bool GetBoolean ( int i )
133
122
{
134
123
return rs . GetBoolean ( i ) ;
135
124
}
136
125
137
- public byte GetByte ( int i )
126
+ public override byte GetByte ( int i )
138
127
{
139
128
return rs . GetByte ( i ) ;
140
129
}
141
130
142
- public long GetBytes ( int i , long fieldOffset , byte [ ] buffer , int bufferoffset , int length )
131
+ public override long GetBytes ( int i , long fieldOffset , byte [ ] buffer , int bufferoffset , int length )
143
132
{
144
133
return rs . GetBytes ( i , fieldOffset , buffer , bufferoffset , length ) ;
145
134
}
146
135
147
- public char GetChar ( int i )
136
+ public override char GetChar ( int i )
148
137
{
149
138
return rs . GetChar ( i ) ;
150
139
}
151
140
152
- public long GetChars ( int i , long fieldoffset , char [ ] buffer , int bufferoffset , int length )
141
+ public override long GetChars ( int i , long fieldoffset , char [ ] buffer , int bufferoffset , int length )
153
142
{
154
143
return rs . GetChars ( i , fieldoffset , buffer , bufferoffset , length ) ;
155
144
}
156
145
157
- public Guid GetGuid ( int i )
146
+ public override Guid GetGuid ( int i )
158
147
{
159
148
return rs . GetGuid ( i ) ;
160
149
}
161
150
162
- public short GetInt16 ( int i )
151
+ public override short GetInt16 ( int i )
163
152
{
164
153
return rs . GetInt16 ( i ) ;
165
154
}
166
155
167
- public int GetInt32 ( int i )
156
+ public override int GetInt32 ( int i )
168
157
{
169
158
return rs . GetInt32 ( i ) ;
170
159
}
171
160
172
- public long GetInt64 ( int i )
161
+ public override long GetInt64 ( int i )
173
162
{
174
163
return rs . GetInt64 ( i ) ;
175
164
}
176
165
177
- public float GetFloat ( int i )
166
+ public override float GetFloat ( int i )
178
167
{
179
168
return rs . GetFloat ( i ) ;
180
169
}
181
170
182
- public double GetDouble ( int i )
171
+ public override double GetDouble ( int i )
183
172
{
184
173
return rs . GetDouble ( i ) ;
185
174
}
186
175
187
- public string GetString ( int i )
176
+ public override string GetString ( int i )
188
177
{
189
178
return rs . GetString ( i ) ;
190
179
}
191
180
192
- public decimal GetDecimal ( int i )
181
+ public override decimal GetDecimal ( int i )
193
182
{
194
183
return rs . GetDecimal ( i ) ;
195
184
}
196
185
197
- public DateTime GetDateTime ( int i )
186
+ public override DateTime GetDateTime ( int i )
198
187
{
199
188
return rs . GetDateTime ( i ) ;
200
189
}
201
190
202
- public DbDataReader GetData ( int i )
191
+ protected override DbDataReader GetDbDataReader ( int ordinal )
203
192
{
204
- return rs . GetData ( i ) ;
193
+ return rs . GetData ( ordinal ) ;
205
194
}
206
195
207
- public bool IsDBNull ( int i )
196
+ public override bool IsDBNull ( int i )
208
197
{
209
198
return rs . IsDBNull ( i ) ;
210
199
}
211
200
212
- public int FieldCount
201
+ public override int FieldCount
213
202
{
214
203
get { return rs . FieldCount ; }
215
204
}
216
205
217
- public object this [ int i ]
206
+ public override object this [ int i ]
218
207
{
219
208
get { return rs [ i ] ; }
220
209
}
221
210
222
- public object this [ string name ]
211
+ public override object this [ string name ]
223
212
{
224
213
get { return rs [ columnNameCache . GetIndexForColumnName ( name , this ) ] ; }
225
214
}
226
215
227
- #endregion
228
-
229
216
public override bool Equals ( object obj )
230
217
{
231
218
return rs . Equals ( obj ) ;
0 commit comments