Skip to content

Commit

Permalink
GH-3530: The SqlServer 2008 driver does not support the DbDataReader.…
Browse files Browse the repository at this point in the history
…Get* methods, wrap it in a DirectCastDbDataReader.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jun 7, 2024
1 parent 36d248a commit 04539b2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
37 changes: 37 additions & 0 deletions src/NHibernate/Async/Driver/Sql2008ClientDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System;
using System.Data;
using System.Data.Common;
using NHibernate.Util;
using NHibernate.AdoNet;

namespace NHibernate.Driver
{
using System.Threading.Tasks;
using System.Threading;
public partial class Sql2008ClientDriver : SqlClientDriver
{

#if NETFX
#else

#endif

public override async Task<DbDataReader> ExecuteReaderAsync(DbCommand command, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var reader = await (command.ExecuteReaderAsync(cancellationToken)).ConfigureAwait(false);

return new DirectCastDbDataReader(reader);
}
}
}
10 changes: 9 additions & 1 deletion src/NHibernate/Driver/Sql2008ClientDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using System.Data;
using System.Data.Common;
using NHibernate.Util;
using NHibernate.AdoNet;

namespace NHibernate.Driver
{
public class Sql2008ClientDriver : SqlClientDriver
public partial class Sql2008ClientDriver : SqlClientDriver
{
const byte MaxTime = 5;

Expand Down Expand Up @@ -34,5 +35,12 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq

/// <inheritdoc />
public override DateTime MinDate => DateTime.MinValue;

public override DbDataReader ExecuteReader(DbCommand command)
{
var reader = command.ExecuteReader();

return new DirectCastDbDataReader(reader);
}
}
}

0 comments on commit 04539b2

Please sign in to comment.