Export (0) Print
Expand All

EntityDataReader Class

Reads a forward-only stream of rows from a data source.

System.Object
  System.MarshalByRefObject
    System.Data.Common.DbDataReader
      System.Data.EntityClient.EntityDataReader

Namespace:  System.Data.EntityClient
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public class EntityDataReader : DbDataReader, 
	IExtendedDataRecord, IDataRecord

The EntityDataReader type exposes the following members.

  NameDescription
Public propertyDataRecordInfoGets DataRecordInfo for this IExtendedDataRecord.
Public propertyDepthGets a value indicating the depth of nesting for the current row. (Overrides DbDataReader.Depth.)
Public propertyFieldCountGets the number of columns in the current row. (Overrides DbDataReader.FieldCount.)
Public propertyHasRowsGets a value that indicates whether this EntityDataReader contains one or more rows. (Overrides DbDataReader.HasRows.)
Public propertyIsClosedGets a value indicating whether the EntityDataReader is closed. (Overrides DbDataReader.IsClosed.)
Public propertyItem[Int32]Gets the value of the specified column as an instance of Object. (Overrides DbDataReader.Item.)
Public propertyItem[String]Gets the value of the specified column as an instance of Object. (Overrides DbDataReader.Item.)
Public propertyRecordsAffectedGets the number of rows changed, inserted, or deleted by execution of the SQL statement. (Overrides DbDataReader.RecordsAffected.)
Public propertyVisibleFieldCountGets the number of fields in the EntityDataReader that are not hidden. (Overrides DbDataReader.VisibleFieldCount.)
Top

  NameDescription
Public methodCloseCloses the EntityDataReader object. (Overrides DbDataReader.Close().)
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the current instance of the DbDataReader class. (Inherited from DbDataReader.)
Protected methodDispose(Boolean)Releases the resources consumed by this EntityDataReader and calls Close. (Overrides DbDataReader.Dispose(Boolean).)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetBooleanGets the value of the specified column as a Boolean. (Overrides DbDataReader.GetBoolean(Int32).)
Public methodGetByteGets the value of the specified column as a byte. (Overrides DbDataReader.GetByte(Int32).)
Public methodGetBytesReads a stream of bytes from the specified column, starting at location indicated by dataIndex, into the buffer, starting at the location indicated by bufferIndex. (Overrides DbDataReader.GetBytes(Int32, Int64, Byte[], Int32, Int32).)
Public methodGetCharGets the value of the specified column as a single character. (Overrides DbDataReader.GetChar(Int32).)
Public methodGetCharsReads a stream of characters from the specified column, starting at location indicated by dataIndex, into the buffer, starting at the location indicated by bufferIndex. (Overrides DbDataReader.GetChars(Int32, Int64, Char[], Int32, Int32).)
Public methodGetDataReturns a DbDataReader object for the requested column ordinal. (Inherited from DbDataReader.)
Public methodGetDataReaderReturns nested readers as DbDataReader objects.
Public methodGetDataRecordReturns a nested DbDataRecord.
Public methodGetDataTypeNameGets the name of the data type of the specified column. (Overrides DbDataReader.GetDataTypeName(Int32).)
Public methodGetDateTimeGets the value of the specified column as a DateTime object. (Overrides DbDataReader.GetDateTime(Int32).)
Protected methodGetDbDataReaderReturns a DbDataReader object for the requested column ordinal that can be overridden with a provider-specific implementation. (Overrides DbDataReader.GetDbDataReader(Int32).)
Public methodGetDecimalGets the value of the specified column as a Decimal object. (Overrides DbDataReader.GetDecimal(Int32).)
Public methodGetDoubleGets the value of the specified column as a double-precision floating point number. (Overrides DbDataReader.GetDouble(Int32).)
Public methodGetEnumeratorReturns an IEnumerator that can be used to iterate through the rows in the data reader. (Overrides DbDataReader.GetEnumerator().)
Public methodGetFieldTypeGets the data type of the specified column. (Overrides DbDataReader.GetFieldType(Int32).)
Public methodGetFieldValue<T>Synchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodGetFieldValueAsync<T>(Int32)Asynchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodGetFieldValueAsync<T>(Int32, CancellationToken)Asynchronously gets the value of the specified column as a type. (Inherited from DbDataReader.)
Public methodGetFloatGets the value of the specified column as a single-precision floating point number. (Overrides DbDataReader.GetFloat(Int32).)
Public methodGetGuidGets the value of the specified column as a globally-unique identifier (GUID). (Overrides DbDataReader.GetGuid(Int32).)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetInt16Gets the value of the specified column as a 16-bit signed integer. (Overrides DbDataReader.GetInt16(Int32).)
Public methodGetInt32Gets the value of the specified column as a 32-bit signed integer. (Overrides DbDataReader.GetInt32(Int32).)
Public methodGetInt64Gets the value of the specified column as a 64-bit signed integer. (Overrides DbDataReader.GetInt64(Int32).)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetNameGets the name of the column, given the zero-based column ordinal. (Overrides DbDataReader.GetName(Int32).)
Public methodGetOrdinalGets the column ordinal given the name of the column. (Overrides DbDataReader.GetOrdinal(String).)
Public methodGetProviderSpecificFieldTypeReturns the provider-specific field type of the specified column. (Overrides DbDataReader.GetProviderSpecificFieldType(Int32).)
Public methodGetProviderSpecificValueGets the value of the specified column as an instance of Object. (Overrides DbDataReader.GetProviderSpecificValue(Int32).)
Public methodGetProviderSpecificValuesGets all provider-specific attribute columns in the collection for the current row. (Overrides DbDataReader.GetProviderSpecificValues(Object[]).)
Public methodGetSchemaTableReturns a DataTable that describes the column metadata of the DbDataReader. (Overrides DbDataReader.GetSchemaTable().)
Public methodGetStreamRetrieves data as a Stream. (Inherited from DbDataReader.)
Public methodGetStringGets the value of the specified column as an instance of String. (Overrides DbDataReader.GetString(Int32).)
Public methodGetTextReaderRetrieves data as a TextReader. (Inherited from DbDataReader.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueGets the value of the specified column as an instance of Object. (Overrides DbDataReader.GetValue(Int32).)
Public methodGetValuesPopulates an array of objects with the column values of the current row. (Overrides DbDataReader.GetValues(Object[]).)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodIsDBNullGets a value that indicates whether the column contains nonexistent or missing values. (Overrides DbDataReader.IsDBNull(Int32).)
Public methodIsDBNullAsync(Int32)An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains non-existent or missing values. (Inherited from DbDataReader.)
Public methodIsDBNullAsync(Int32, CancellationToken)An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains non-existent or missing values. Optionally, sends a notification that operations should be cancelled. (Inherited from DbDataReader.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodNextResultAdvances the reader to the next result when reading the results of a batch of statements. (Overrides DbDataReader.NextResult().)
Public methodNextResultAsync()An asynchronous version of NextResult, which advances the reader to the next result when reading the results of a batch of statements.Invokes NextResultAsync with CancellationToken.None. (Inherited from DbDataReader.)
Public methodNextResultAsync(CancellationToken)This is the asynchronous version of NextResult. Providers should override with an appropriate implementation. The cancellationToken may optionally be ignored.The default implementation invokes the synchronous NextResult method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by NextResult will be communicated via the returned Task Exception property.Other methods and properties of the DbDataReader object should not be invoked while the returned Task is not yet completed. (Inherited from DbDataReader.)
Public methodReadAdvances the reader to the next record in a result set. (Overrides DbDataReader.Read().)
Public methodReadAsync()An asynchronous version of Read, which advances the reader to the next record in a result set. This method invokes ReadAsync with CancellationToken.None. (Inherited from DbDataReader.)
Public methodReadAsync(CancellationToken)This is the asynchronous version of Read. Providers should override with an appropriate implementation. The cancellationToken may optionally be ignored.The default implementation invokes the synchronous Read method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by Read will be communicated via the returned Task Exception property.Do not invoke other methods and properties of the DbDataReader object until the returned Task is complete. (Inherited from DbDataReader.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIDataRecord.GetDataFor a description of this member, see IDataRecord.GetData. (Inherited from DbDataReader.)
Top

Combines the functionality of the DbDataReader class and the IExtendedDataRecord interface.

An EntityDataReader has no public constructor. It can only be obtained through one of the EntityCommand.ExecuteReader method overloads.

SQL 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. If the application closes the EntityDataReader (which would also close the DbDataReader), output parameters might not be populated.

EntityDataReader does not implicitly consume result sets to make output parameters available. Therefore, note the following:

For code examples, see Working with EntityClient.

.NET Framework

Supported in: 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft