Table of Contents

Class RelationalDataReader

Namespace
Microsoft.EntityFrameworkCore.Storage
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Reads result sets from a relational database.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class RelationalDataReader : IDisposable, IAsyncDisposable
Inheritance
RelationalDataReader
Implements
Inherited Members

Remarks

See Implementation of database providers and extensions for more information and examples.

Constructors

RelationalDataReader()

public RelationalDataReader()

Properties

CommandId

A correlation ID that identifies the DbCommand instance being used.

public virtual Guid CommandId { get; }

Property Value

Guid

DbCommand

Gets the underlying command for the result set.

public virtual DbCommand DbCommand { get; }

Property Value

DbCommand

DbDataReader

Gets the underlying reader for the result set.

public virtual DbDataReader DbDataReader { get; }

Property Value

DbDataReader

RelationalConnection

Gets the underlying relational connection being used.

public virtual IRelationalConnection RelationalConnection { get; }

Property Value

IRelationalConnection

Methods

Close()

Closes the reader.

public virtual void Close()

CloseAsync()

Closes the reader.

public virtual ValueTask CloseAsync()

Returns

ValueTask

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual ValueTask DisposeAsync()

Returns

ValueTask

Initialize(IRelationalConnection, DbCommand, DbDataReader, Guid, IRelationalCommandDiagnosticsLogger?)

Initializes a new instance of the RelationalDataReader class.

public virtual void Initialize(IRelationalConnection relationalConnection, DbCommand command, DbDataReader reader, Guid commandId, IRelationalCommandDiagnosticsLogger? logger)

Parameters

relationalConnection IRelationalConnection

The relational connection.

command DbCommand

The command that was executed.

reader DbDataReader

The underlying reader for the result set.

commandId Guid

A correlation ID that identifies the DbCommand instance being used.

logger IRelationalCommandDiagnosticsLogger

The diagnostic source.

Read()

Calls Read() on the underlying DbDataReader.

public virtual bool Read()

Returns

bool

true if there are more rows; otherwise false.

ReadAsync(CancellationToken)

Calls ReadAsync(CancellationToken) on the underlying DbDataReader.

public virtual Task<bool> ReadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<bool>

true if there are more rows; otherwise false.