Skip to content

Commit

Permalink
GH-3530: The MicrosoftDataSqlClientDriver does not support the DbData…
Browse files Browse the repository at this point in the history
…Reader.GetChar method, wrap it with the SqlServerDbDataReader.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jun 11, 2024
1 parent cd6fa30 commit cc0aff8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
36 changes: 36 additions & 0 deletions src/NHibernate/Async/Driver/MicrosoftDataSqlClientDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <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.Collections.Generic;
using System.Data;
using System.Data.Common;
using NHibernate.AdoNet;
using NHibernate.Dialect;
using NHibernate.Engine;
using NHibernate.SqlTypes;
using NHibernate.Util;

namespace NHibernate.Driver
{
using System.Threading.Tasks;
using System.Threading;
public partial class MicrosoftDataSqlClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider, IParameterAdjuster
{

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

return new SqlServerDbDataReader(reader);
}
}
}
9 changes: 8 additions & 1 deletion src/NHibernate/Driver/MicrosoftDataSqlClientDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace NHibernate.Driver
/// <summary>
/// A NHibernate Driver for using the SqlClient DataProvider
/// </summary>
public class MicrosoftDataSqlClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider, IParameterAdjuster
public partial class MicrosoftDataSqlClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider, IParameterAdjuster
{
const byte MaxTime = 5;

Expand Down Expand Up @@ -217,5 +217,12 @@ public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor sess
{
return new BasicResultSetsCommand(session);
}

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

return new SqlServerDbDataReader(reader);
}
}
}

0 comments on commit cc0aff8

Please sign in to comment.