-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async System.Data resultset and database schema APIs #38028
Comments
namespace System.Data.Common
{
public partial class DbConnection
{
public virtual Task<DataTable> GetSchemaAsync(CancellationToken cancellationToken = default);
public virtual Task<DataTable> GetSchemaAsync(string collectionName, CancellationToken cancellationToken = default);
public virtual Task<DataTable> GetSchemaAsync(string collectionName, string[] restrictions, CancellationToken cancellationToken = default);
}
public partial class DbDataReader
{
public virtual Task<DataTable> GetSchemaTableAsync(CancellationToken cancellationToken = default);
public virtual Task<ReadOnlyCollection<DbColumn>> GetColumnSchemaAsync(CancellationToken cancellationToken = default);
}
} |
Should nullable annotations be discussed in this PR, or does that depend on whether #689 is merged before or afterwards? The only change I would make is |
We should, yes, thanks, @bgrainger. The nullable annotations on these should match those on the sync equivalents, and I see that the sync variant does have |
From #16305
CC @saurabh500 in case there's anything to add here. |
The reason for DbDataReaderExtensions.GetColumnSchema() and IDbColumnSchemaGenerator is that it falls back to DbDataReader.GetColumnSchema() and an adapter when the reader doesn't implement the interface. runtime/src/libraries/System.Data.Common/src/System/Data/Common/DbDataReaderExtensions.cs Lines 54 to 65 in 4f9ae42
The reason that it wasn't implemented directly on DbDataReader is because it was added over .NET Standard 1.2 where the DbDataReader type is forwarded to .NET Framework's System.Data assembly (where we couldn't add API) while the interface and the extension method live in the .NET Standard System.Data.Common assembly (where we could add API). In other words, I think it's perfectly fine to add DbDataReader.GetColumnSchemaAsync() directly in .NET 5 given that we don't need to maintain compatibility with .NET Framework. |
Thanks for looking into this @bgrainger and @bricelam |
Provider tracking issues
This new API has been merged, following are tracking issues for implementation in the different providers:
MySqlConnector: Async resultset and database schema APIs mysql-net/MySqlConnector#835Background and Motivation
This proposal introduces async counterparts to existing sync APIs for fetching schema information for resultset and database schema. The original proposal was developed by @manandre and @bgrainger in npgsql/npgsql#2976.
Proposed API
Notes
/cc @David-Engel @cheenamalhotra @bgrainger @manandre @bricelam @ajcvickers @stephentoub @terrajobst @mgravell @FransBouma
The text was updated successfully, but these errors were encountered: