Skip to content

Commit f8f9060

Browse files
David EllingsworthDavid Ellingsworth
David Ellingsworth
authored and
David Ellingsworth
committed
GH-3530: The SqlServer 2008 driver does not support the DbDataReader.Get* methods, wrap it in a DirectCastDbDataReader.
1 parent 16ec1c0 commit f8f9060

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System;
12+
using System.Data;
13+
using System.Data.Common;
14+
using NHibernate.Util;
15+
16+
namespace NHibernate.Driver
17+
{
18+
using System.Threading.Tasks;
19+
using System.Threading;
20+
public partial class Sql2008ClientDriver : SqlClientDriver
21+
{
22+
23+
#if NETFX
24+
#else
25+
26+
#endif
27+
28+
public override async Task<DbDataReader> ExecuteReaderAsync(DbCommand command, CancellationToken cancellationToken)
29+
{
30+
cancellationToken.ThrowIfCancellationRequested();
31+
var reader = await (command.ExecuteReaderAsync(cancellationToken)).ConfigureAwait(false);
32+
33+
return new DirectCastDbDataReader(reader);
34+
}
35+
}
36+
}

src/NHibernate/Driver/Sql2008ClientDriver.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace NHibernate.Driver
77
{
8-
public class Sql2008ClientDriver : SqlClientDriver
8+
public partial class Sql2008ClientDriver : SqlClientDriver
99
{
1010
const byte MaxTime = 5;
1111

@@ -34,5 +34,12 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq
3434

3535
/// <inheritdoc />
3636
public override DateTime MinDate => DateTime.MinValue;
37+
38+
public override DbDataReader ExecuteReader(DbCommand command)
39+
{
40+
var reader = command.ExecuteReader();
41+
42+
return new DirectCastDbDataReader(reader);
43+
}
3744
}
3845
}

0 commit comments

Comments
 (0)