Skip to content

Fix typed reader return from ClickHouseCommand (#690) - #708

Open
bjsneto wants to merge 1 commit into
ClickHouse:mainfrom
bjsneto:fix/clickhousecommand-execute-reader-return-type
Open

bjsneto wants to merge 1 commit into
ClickHouse:mainfrom
bjsneto:fix/clickhousecommand-execute-reader-return-type

Conversation

@bjsneto

@bjsneto bjsneto commented Nov 1, 2026 •

Copy link
Copy Markdown

Description

ClickHouseCommand did not expose strongly typed ExecuteReader and ExecuteReaderAsync methods.

Calls on a ClickHouseCommand instance resolved to the inherited DbCommand methods, returning DbDataReader and Task<DbDataReader> respectively.

As a result, documented examples using TryGetEnumOrdinal and other ClickHouseDataReader-specific members failed to compile without an explicit cast.

This PR introduces typed new overloads for ExecuteReader and ExecuteReaderAsync, following the existing API hiding pattern used by CreateParameter().

The change allows consumers to access ClickHouse-specific reader functionality directly while preserving the standard ADO.NET behavior when commands are accessed through the DbCommand abstraction.

Fixes #690

Changes

  • Added strongly typed ExecuteReader and ExecuteReaderAsync overloads to ClickHouseCommand.
  • Updated PublicAPI.Unshipped.txt with the new public API signatures.
  • Added a changelog fragment under changelog.d/.
  • Added regression tests covering typed reader access and DbCommand compatibility.

How to Test

  • Build the solution successfully.
  • Run the ClickHouse.Driver.Tests test suite.
  • Verify that ClickHouseCommand.ExecuteReaderAsync() exposes ClickHouseDataReader without requiring an explicit cast.
  • Verify that ClickHouse-specific methods such as TryGetEnumOrdinal are accessible directly.
  • Verify that execution through DbCommand continues to work as expected.
  • Run the changelog validation script.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClickHouseCommand: await command.ExecuteReaderAsync() is typed DbDataReader, so the documented TryGetEnumOrdinal example does not compile

2 participants