Skip to content

Commit cd14c78

Browse files
maca88hazzik
authored andcommitted
Added missing async overrides for custom readers
1 parent 2c59b37 commit cd14c78

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

src/NHibernate/AdoNet/ResultSetWrapper.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
using System.Collections;
33
using System.Data;
44
using System.Data.Common;
5+
#if ASYNC
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
#endif
59

610
namespace NHibernate.AdoNet
711
{
@@ -47,6 +51,23 @@ public override bool Read()
4751
return rs.Read();
4852
}
4953

54+
#if ASYNC
55+
public override Task<bool> ReadAsync(CancellationToken cancellationToken)
56+
{
57+
return rs.ReadAsync(cancellationToken);
58+
}
59+
60+
public override Task<bool> NextResultAsync(CancellationToken cancellationToken)
61+
{
62+
return rs.NextResultAsync(cancellationToken);
63+
}
64+
65+
public override Task<bool> IsDBNullAsync(int ordinal, CancellationToken cancellationToken)
66+
{
67+
return rs.IsDBNullAsync(ordinal, cancellationToken);
68+
}
69+
#endif
70+
5071
public override int Depth
5172
{
5273
get { return rs.Depth; }

src/NHibernate/Driver/BasicResultSetsCommand.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
using NHibernate.Engine;
88
using NHibernate.SqlCommand;
99
using NHibernate.SqlTypes;
10+
#if ASYNC
11+
using System.Threading;
12+
using System.Threading.Tasks;
13+
#endif
1014

1115
namespace NHibernate.Driver
1216
{
@@ -273,6 +277,23 @@ public override bool Read()
273277
return reader.Read();
274278
}
275279

280+
#if ASYNC
281+
public override Task<bool> ReadAsync(CancellationToken cancellationToken)
282+
{
283+
return reader.ReadAsync(cancellationToken);
284+
}
285+
286+
public override Task<bool> IsDBNullAsync(int ordinal, CancellationToken cancellationToken)
287+
{
288+
return reader.IsDBNullAsync(ordinal, cancellationToken);
289+
}
290+
291+
public override Task<bool> NextResultAsync(CancellationToken cancellationToken)
292+
{
293+
return reader.NextResultAsync(cancellationToken);
294+
}
295+
#endif
296+
276297
public override int Depth
277298
{
278299
get { return reader.Depth; }

src/NHibernate/Driver/NDataReader.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Data;
55
using System.Data.Common;
66
using NHibernate.Util;
7+
#if ASYNC
8+
using System.Threading;
9+
using System.Threading.Tasks;
10+
#endif
711

812
namespace NHibernate.Driver
913
{
@@ -161,6 +165,23 @@ public override bool Read()
161165
return true;
162166
}
163167

168+
#if ASYNC
169+
public override Task<bool> ReadAsync(CancellationToken cancellationToken)
170+
{
171+
return Task.FromResult(Read());
172+
}
173+
174+
public override Task<bool> NextResultAsync(CancellationToken cancellationToken)
175+
{
176+
return Task.FromResult(NextResult());
177+
}
178+
179+
public override Task<bool> IsDBNullAsync(int ordinal, CancellationToken cancellationToken)
180+
{
181+
return Task.FromResult(IsDBNull(ordinal));
182+
}
183+
#endif
184+
164185
/// <summary></summary>
165186
public override int Depth
166187
{

src/NHibernate/Driver/NHybridDataReader.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
using System.Collections;
33
using System.Data;
44
using System.Data.Common;
5+
#if ASYNC
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
#endif
59

610
namespace NHibernate.Driver
711
{
@@ -126,6 +130,25 @@ public override bool Read()
126130
return _isMidstream;
127131
}
128132

133+
#if ASYNC
134+
public override async Task<bool> ReadAsync(CancellationToken cancellationToken)
135+
{
136+
_isMidstream = await _reader.ReadAsync(cancellationToken);
137+
return _isMidstream;
138+
}
139+
140+
public override Task<bool> NextResultAsync(CancellationToken cancellationToken)
141+
{
142+
_isMidstream = false;
143+
return _reader.NextResultAsync(cancellationToken);
144+
}
145+
146+
public override Task<bool> IsDBNullAsync(int ordinal, CancellationToken cancellationToken)
147+
{
148+
return _reader.IsDBNullAsync(ordinal, cancellationToken);
149+
}
150+
#endif
151+
129152
/// <summary></summary>
130153
public override int Depth
131154
{

0 commit comments

Comments
 (0)