Skip to content

Help returning DataReader in Async "world". #1249

@vincenzo-antolini-os

Description

@vincenzo-antolini-os

Hi,
doing some test with this library because the Oracle one is too bugged when connecting to MariaDb and this lib is very promising.
I'm very attracted by the Async features, I would like to migrate all currently developing software.

Need help... line return await command.ExecuteReaderAsync(); throws an exception.
Is the way I use it not correct.
I read again and again this snippet and nothing seems weird.
If, instead of returning the DataReader, I loop through it works.
Some suggestion?
Thanks

Follow snippet

public async Task<IDataReader> GetDataReaderAsync(string commandText)
{
        await using var connection = (MySqlConnection) DbHelper.CreateDbConnection(ProviderName, ConnectionString);
        await connection.OpenAsync();
        await using var command = new MySqlCommand(commandText, connection);
        return await command.ExecuteReaderAsync();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions