Skip to content

Conversation

edwardneal
Copy link
Contributor

@edwardneal edwardneal commented Nov 14, 2024

Contributes to #646, adding SqlConnection.GetSchemaAsync.

I can't add the IDbColumnSchemaGenerator method because the .NET Framework version of SqlDataReader doesn't yet implement that interface. #2967 tracks this. SqlDataReader.GetSchemaTableAsync requires some extra work with the state machine to guarantee that the column metadata is available, and I'll submit a separate PR for this.

I've added some basic documentation, but this effectively follows the SqlCommand.[Something]Async pattern of "An asynchronous version of [Something], which <etc.>"

I've also moved the netfx GetSchema methods from SqlConnectionHelper.cs to SqlConnection.cs, to align that part of it with netcore. This contributes to the merge slightly.

}

private DataTable ExecuteCommand(DataRow requestedCollectionRow, string[] restrictions, DbConnection connection)
private async ValueTask<DataTable> ExecuteCommandAsync(DataRow requestedCollectionRow, string[] restrictions, DbConnection connection, bool isAsync, CancellationToken cancellationToken)
Copy link
Member

Choose a reason for hiding this comment

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

Really nice to be seeing proper async/await in SqlClient!

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.96%. Comparing base (33a8d53) to head (a3def44).
⚠️ Report is 1 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (33a8d53) and HEAD (a3def44). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (33a8d53) HEAD (a3def44)
addons 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3005       +/-   ##
===========================================
- Coverage   90.82%   69.96%   -20.87%     
===========================================
  Files           6      267      +261     
  Lines         316    45761    +45445     
===========================================
+ Hits          287    32015    +31728     
- Misses         29    13746    +13717     
Flag Coverage Δ
addons ?
netcore 70.79% <100.00%> (?)
netfx 69.97% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edwardneal edwardneal changed the title Implement SqlConnection.GetSchemaAsync Implement SqlConnection.GetSchemaAsync and SqlDataReader.GetSchemaTableAsync Nov 15, 2024
@edwardneal edwardneal marked this pull request as draft November 15, 2024 22:38
This introduces async-over-sync, removing such requires work with the state machine and separate review.
@edwardneal edwardneal marked this pull request as ready for review November 16, 2024 08:56
@edwardneal edwardneal changed the title Implement SqlConnection.GetSchemaAsync and SqlDataReader.GetSchemaTableAsync Implement SqlConnection.GetSchemaAsync Nov 16, 2024
@mdaigle mdaigle added Enhancement 💡 Issues that are feature requests for the drivers we maintain. Public API 🆕 Issues/PRs that introduce new APIs to the driver. labels Nov 25, 2024
@paulmedynski
Copy link
Contributor

@edwardneal - Can you resolve the conflicts, and then I will kick off another CI run?

@edwardneal edwardneal requested a review from a team as a code owner July 2, 2025 21:14
@edwardneal
Copy link
Contributor Author

Thanks @paulmedynski, I've just brought the branch up to date.

@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

A few inconsistencies and questions.

@paulmedynski paulmedynski requested a review from a team July 4, 2025 10:20
Remove SqlDataReader.GetSchemaTableAsync (and references to such.)
Expand test coverage of both GetSchema and GetSchemaAsync.
Correct typo in documentation for GetSchema and GetSchemaAsync.
paulmedynski
paulmedynski previously approved these changes Jul 10, 2025
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@paulmedynski paulmedynski requested a review from a team July 11, 2025 19:58
@paulmedynski paulmedynski self-assigned this Aug 29, 2025
@edwardneal
Copy link
Contributor Author

edwardneal commented Oct 1, 2025

I've updated this branch after the SqlConnection merges were applied, could I have a CI run please?

@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@paulmedynski
Copy link
Contributor

@edwardneal - Sigh, more conflicts.

@edwardneal
Copy link
Contributor Author

Yes - merged, thanks.

@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 💡 Issues that are feature requests for the drivers we maintain. Public API 🆕 Issues/PRs that introduce new APIs to the driver.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants