Skip to content

Commit

Permalink
GH-3530: The Sql2008ClientDriver does not implement the DbDataReader.…
Browse files Browse the repository at this point in the history
…Get* methods. Enacapsulte their DbDataReader with the DirectCastDbDataReader.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed May 30, 2024
1 parent 1038447 commit 9e0e6b2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/NHibernate/Driver/Sql2008ClientDriver.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System;
using System.Data;
using System.Data.Common;
using NHibernate.AdoNet;
using NHibernate.Util;

namespace NHibernate.Driver
{
public class Sql2008ClientDriver : SqlClientDriver
{

const byte MaxTime = 5;

#if NETFX
Expand Down Expand Up @@ -34,5 +36,24 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq

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

private partial class Sql2008DbCommandWrapper : DbCommandWrapper
{
public Sql2008DbCommandWrapper(DbCommand command) : base(command) { }

protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
{
var reader = Command.ExecuteReader(behavior);

return new DirectCastDbDataReader(reader);
}
}

public override DbCommand CreateCommand()
{
var cmd = base.CreateCommand();

return new Sql2008DbCommandWrapper(cmd);
}
}
}

0 comments on commit 9e0e6b2

Please sign in to comment.