From 9e0e6b23e7a5022f1603d825a66df454db396ad0 Mon Sep 17 00:00:00 2001 From: David Ellingsworth Date: Thu, 30 May 2024 16:39:32 -0400 Subject: [PATCH] GH-3530: The Sql2008ClientDriver does not implement the DbDataReader.Get* methods. Enacapsulte their DbDataReader with the DirectCastDbDataReader. --- src/NHibernate/Driver/Sql2008ClientDriver.cs | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/NHibernate/Driver/Sql2008ClientDriver.cs b/src/NHibernate/Driver/Sql2008ClientDriver.cs index 0068832139f..4674d90bc45 100644 --- a/src/NHibernate/Driver/Sql2008ClientDriver.cs +++ b/src/NHibernate/Driver/Sql2008ClientDriver.cs @@ -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 @@ -34,5 +36,24 @@ protected override void InitializeParameter(DbParameter dbParam, string name, Sq /// 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); + } } }