EntityDataReader EntityDataReader EntityDataReader EntityDataReader Class

定义

从数据源中读取行的只进流。Reads a forward-only stream of rows from a data source.

public ref class EntityDataReader : System::Data::Common::DbDataReader, System::Data::IExtendedDataRecord
public class EntityDataReader : System.Data.Common.DbDataReader, System.Data.IExtendedDataRecord
type EntityDataReader = class
    inherit DbDataReader
    interface IExtendedDataRecord
    interface IDataRecord
Public Class EntityDataReader
Inherits DbDataReader
Implements IExtendedDataRecord
继承
实现

注解

组合了 DbDataReader 类和 IExtendedDataRecord 接口的功能。Combines the functionality of the DbDataReader class and the IExtendedDataRecord interface.

EntityDataReader 没有公共构造函数。An EntityDataReader has no public constructor. 它只能通过EntityCommand.ExecuteReader方法重载之一来获取。It can only be obtained through one of the EntityCommand.ExecuteReader method overloads.

SQL ServerSQL Server puts output parameters from stored procedures at the end of the result stream, after all the result sets. 因此,为了获取输出参数值,应用程序必须耗用所有结果集中的所有记录。Therefore, to get output parameter values, an application must consume all the records in all the result sets. 如果应用程序关闭 EntityDataReader(这将同时关闭 DbDataReader),那么输出参数可能未填充值。If the application closes the EntityDataReader (which would also close the DbDataReader), output parameters might not be populated.

EntityDataReader 不会隐式耗用结果集以使输出参数可用。EntityDataReader does not implicitly consume result sets to make output parameters available. 因此,请注意以下几点:Therefore, note the following:

有关代码示例, 请参阅使用EntityClientFor code examples, see Working with EntityClient.

属性

DataRecordInfo DataRecordInfo DataRecordInfo DataRecordInfo

获取此 DataRecordInfoIExtendedDataRecordGets DataRecordInfo for this IExtendedDataRecord.

Depth Depth Depth Depth

获取一个值,该值指示当前行的嵌套深度。Gets a value indicating the depth of nesting for the current row.

FieldCount FieldCount FieldCount FieldCount

获取当前行中的列数。Gets the number of columns in the current row.

HasRows HasRows HasRows HasRows

获取一个值,该值指示此 EntityDataReader 是否包含一个或多个行。Gets a value that indicates whether this EntityDataReader contains one or more rows.

IsClosed IsClosed IsClosed IsClosed

获取一个值,该值指示 EntityDataReader 是否已关闭。Gets a value indicating whether the EntityDataReader is closed.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Object 实例的形式获取指定列的值。Gets the value of the specified column as an instance of Object.

Item[String] Item[String] Item[String] Item[String]

Object 实例的形式获取指定列的值。Gets the value of the specified column as an instance of Object.

RecordsAffected RecordsAffected RecordsAffected RecordsAffected

获取通过执行 SQL 语句更改、插入或删除的行数。Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

VisibleFieldCount VisibleFieldCount VisibleFieldCount VisibleFieldCount

获取 EntityDataReader 中未隐藏的字段的数目。Gets the number of fields in the EntityDataReader that are not hidden.

方法

Close() Close() Close() Close()

关闭 EntityDataReader 对象。Closes the EntityDataReader object.

CloseAsync() CloseAsync() CloseAsync() CloseAsync()

异步关闭 DbDataReader 对象。Asynchronously closes the DbDataReader object.

(Inherited from DbDataReader)
CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

释放 DbDataReader 类的当前实例所使用的所有资源。Releases all resources used by the current instance of the DbDataReader class.

(Inherited from DbDataReader)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放由此 EntityDataReader 占用的资源并调用 Close()Releases the resources consumed by this EntityDataReader and calls Close().

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()

异步释放 DbDataReader 类的当前实例所使用的所有资源。Asynchronously releases all resources used by the current instance of the DbDataReader class.

(Inherited from DbDataReader)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBoolean(Int32) GetBoolean(Int32) GetBoolean(Int32) GetBoolean(Int32)

获取指定列的布尔值形式的值。Gets the value of the specified column as a Boolean.

GetByte(Int32) GetByte(Int32) GetByte(Int32) GetByte(Int32)

以字节的形式获取指定列的值。Gets the value of the specified column as a byte.

GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32) GetBytes(Int32, Int64, Byte[], Int32, Int32)

从指定列读取一个字节流(从 dataIndex 指示的位置开始),读到缓冲区中(从 bufferIndex 指示的位置开始)。Reads a stream of bytes from the specified column, starting at location indicated by dataIndex, into the buffer, starting at the location indicated by bufferIndex.

GetChar(Int32) GetChar(Int32) GetChar(Int32) GetChar(Int32)

以单个字符的形式获取指定列的值。Gets the value of the specified column as a single character.

GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32) GetChars(Int32, Int64, Char[], Int32, Int32)

从指定列读取一个字符流,从 dataIndex 指示的位置开始,读到缓冲区中,从 bufferIndex 指示的位置开始。Reads a stream of characters from the specified column, starting at location indicated by dataIndex, into the buffer, starting at the location indicated by bufferIndex.

GetData(Int32) GetData(Int32) GetData(Int32) GetData(Int32)

返回所请求列的嵌套数据读取器。Returns a nested data reader for the requested column.

(Inherited from DbDataReader)
GetDataReader(Int32) GetDataReader(Int32) GetDataReader(Int32) GetDataReader(Int32)

DbDataReader 对象的形式返回嵌套的读取器。Returns nested readers as DbDataReader objects.

GetDataRecord(Int32) GetDataRecord(Int32) GetDataRecord(Int32) GetDataRecord(Int32)

返回嵌套的 DbDataRecordReturns a nested DbDataRecord.

GetDataTypeName(Int32) GetDataTypeName(Int32) GetDataTypeName(Int32) GetDataTypeName(Int32)

获取指定列的数据类型的名称。Gets the name of the data type of the specified column.

GetDateTime(Int32) GetDateTime(Int32) GetDateTime(Int32) GetDateTime(Int32)

DateTime 对象的形式获取指定列的值。Gets the value of the specified column as a DateTime object.

GetDbDataReader(Int32) GetDbDataReader(Int32) GetDbDataReader(Int32) GetDbDataReader(Int32)

返回被请求的列序号的 DbDataReader 对象,可以使用提供程序特定的实现对该对象进行重写。Returns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation.

GetDecimal(Int32) GetDecimal(Int32) GetDecimal(Int32) GetDecimal(Int32)

Decimal 对象的形式获取指定列的值。Gets the value of the specified column as a Decimal object.

GetDouble(Int32) GetDouble(Int32) GetDouble(Int32) GetDouble(Int32)

以双精度浮点数字的形式获取指定列的值。Gets the value of the specified column as a double-precision floating point number.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回一个可用于循环访问数据读取器中的行的 IEnumeratorReturns an IEnumerator that can be used to iterate through the rows in the data reader.

GetFieldType(Int32) GetFieldType(Int32) GetFieldType(Int32) GetFieldType(Int32)

获取指定列的数据类型。Gets the data type of the specified column.

GetFieldValue<T>(Int32) GetFieldValue<T>(Int32) GetFieldValue<T>(Int32) GetFieldValue<T>(Int32)

获取指定列的值作为请求的类型。Gets the value of the specified column as the requested type.

(Inherited from DbDataReader)
GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32) GetFieldValueAsync<T>(Int32)

异步获取指定列的值作为请求的类型。Asynchronously gets the value of the specified column as the requested type.

(Inherited from DbDataReader)
GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken) GetFieldValueAsync<T>(Int32, CancellationToken)

异步获取指定列的值作为请求的类型。Asynchronously gets the value of the specified column as the requested type.

(Inherited from DbDataReader)
GetFloat(Int32) GetFloat(Int32) GetFloat(Int32) GetFloat(Int32)

以单精度浮点数字的形式获取指定列的值。Gets the value of the specified column as a single-precision floating point number.

GetGuid(Int32) GetGuid(Int32) GetGuid(Int32) GetGuid(Int32)

以全局唯一标识符 (GUID) 的形式获取指定列的值。Gets the value of the specified column as a globally-unique identifier (GUID).

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetInt16(Int32) GetInt16(Int32) GetInt16(Int32) GetInt16(Int32)

获取指定列的 16 位有符号整数形式的值。Gets the value of the specified column as a 16-bit signed integer.

GetInt32(Int32) GetInt32(Int32) GetInt32(Int32) GetInt32(Int32)

获取指定列的 32 位带符号整数形式的值。Gets the value of the specified column as a 32-bit signed integer.

GetInt64(Int32) GetInt64(Int32) GetInt64(Int32) GetInt64(Int32)

以 64 位有符号整数的形式获取指定列的值。Gets the value of the specified column as a 64-bit signed integer.

GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetName(Int32) GetName(Int32) GetName(Int32) GetName(Int32)

在给定从零开始的列序号时获取该列的名称。Gets the name of the column, given the zero-based column ordinal.

GetOrdinal(String) GetOrdinal(String) GetOrdinal(String) GetOrdinal(String)

在给定列名时获取相应的列序号。Gets the column ordinal given the name of the column.

GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32) GetProviderSpecificFieldType(Int32)

返回指定列的提供程序特定的字段类型。Returns the provider-specific field type of the specified column.

GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32) GetProviderSpecificValue(Int32)

Object 实例的形式获取指定列的值。Gets the value of the specified column as an instance of Object.

GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[]) GetProviderSpecificValues(Object[])

在当前行的集合中获取提供程序特定的所有属性列。Gets all provider-specific attribute columns in the collection for the current row.

GetSchemaTable() GetSchemaTable() GetSchemaTable() GetSchemaTable()

返回一个描述 DataTable 的列元数据的 DbDataReaderReturns a DataTable that describes the column metadata of the DbDataReader.

GetStream(Int32) GetStream(Int32) GetStream(Int32) GetStream(Int32)

获取从指定列检索数据的流。Gets a stream to retrieve data from the specified column.

(Inherited from DbDataReader)
GetString(Int32) GetString(Int32) GetString(Int32) GetString(Int32)

String 实例的形式获取指定列的值。Gets the value of the specified column as an instance of String.

GetTextReader(Int32) GetTextReader(Int32) GetTextReader(Int32) GetTextReader(Int32)

获取文本读取器以从列中检索数据。Gets a text reader to retrieve data from the column.

(Inherited from DbDataReader)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
GetValue(Int32) GetValue(Int32) GetValue(Int32) GetValue(Int32)

Object 实例的形式获取指定列的值。Gets the value of the specified column as an instance of Object.

GetValues(Object[]) GetValues(Object[]) GetValues(Object[]) GetValues(Object[])

使用当前行的列值来填充对象数组。Populates an array of objects with the column values of the current row.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
IsDBNull(Int32) IsDBNull(Int32) IsDBNull(Int32) IsDBNull(Int32)

获取一个值,该值指示列中是否包含不存在或丢失的值。Gets a value that indicates whether the column contains nonexistent or missing values.

IsDBNullAsync(Int32) IsDBNullAsync(Int32) IsDBNullAsync(Int32) IsDBNullAsync(Int32)

异步获取一个值,该值指示列中是否包含不存在的或缺少的值。Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

(Inherited from DbDataReader)
IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken) IsDBNullAsync(Int32, CancellationToken)

异步获取一个值,该值指示列中是否包含不存在的或缺少的值。Asynchronously gets a value that indicates whether the column contains non-existent or missing values.

(Inherited from DbDataReader)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
NextResult() NextResult() NextResult() NextResult()

在读取一批语句的结果时,使读取器前进到下一个结果。Advances the reader to the next result when reading the results of a batch of statements.

NextResultAsync() NextResultAsync() NextResultAsync() NextResultAsync()

在读取一批语句的结果时,使读取器异步前进到下一个结果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

(Inherited from DbDataReader)
NextResultAsync(CancellationToken) NextResultAsync(CancellationToken) NextResultAsync(CancellationToken) NextResultAsync(CancellationToken)

在读取一批语句的结果时,使读取器异步前进到下一个结果。Asynchronously advances the reader to the next result when reading the results of a batch of statements.

(Inherited from DbDataReader)
Read() Read() Read() Read()

使读取器前进到结果集中的下一条记录。Advances the reader to the next record in a result set.

ReadAsync() ReadAsync() ReadAsync() ReadAsync()

使读取器异步前进到结果集中的下一条记录。Asynchronously advances the reader to the next record in a result set.

(Inherited from DbDataReader)
ReadAsync(CancellationToken) ReadAsync(CancellationToken) ReadAsync(CancellationToken) ReadAsync(CancellationToken)

使读取器异步前进到结果集中的下一条记录。Asynchronously advances the reader to the next record in a result set.

(Inherited from DbDataReader)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

IDataReader.Close() IDataReader.Close() IDataReader.Close() IDataReader.Close()

有关此成员的说明,请参见 Close()For a description of this member, see Close().

(Inherited from DbDataReader)
IDataReader.GetSchemaTable() IDataReader.GetSchemaTable() IDataReader.GetSchemaTable() IDataReader.GetSchemaTable()

有关此成员的说明,请参见 GetSchemaTable()For a description of this member, see GetSchemaTable().

(Inherited from DbDataReader)
IDataRecord.GetData(Int32) IDataRecord.GetData(Int32) IDataRecord.GetData(Int32) IDataRecord.GetData(Int32)

有关此成员的说明,请参见 GetData(Int32)For a description of this member, see GetData(Int32).

(Inherited from DbDataReader)

扩展方法

CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader) CanGetColumnSchema(DbDataReader)

获取一个值,指示 DbDataReader 是否可以获取列架构。Gets a value that indicates whether a DbDataReader can get a column schema.

GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader) GetColumnSchema(DbDataReader)

获取 DbDataReader 的列架构(DbColumn 集合)。Gets the column schema (DbColumn collection) for a DbDataReader.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于