ObjectContext.Translate<TElement> Method (DbDataReader)

.NET Framework (current version)
 

Translates a DbDataReader that contains rows of entity data to objects of the requested entity type.

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

public ObjectResult<TElement> Translate<TElement>(
	DbDataReader reader
)

Parameters

reader
Type: System.Data.Common.DbDataReader

The DbDataReader that contains entity data to translate into entity objects.

Return Value

Type: System.Data.Objects.ObjectResult<TElement>

An enumeration of objects of type TResult.

Type Parameters

TResult

The entity type of the data in the DbDataReader.

Exception Condition
ArgumentNullException

When reader is null.

The Translate<TElement> method is used to translate entity data from a DbDataReader into objects of the requested type. This process is performed automatically when an ObjectQuery<T> is executed to return entity data. The Translate<TElement> method enables you to execute a standard ADO.NET query against a data source and translate the returned data rows into entity objects.

The supplied DbDataReader must contain data that maps to the requested entity type.

For more information, see:

Directly Executing Store Commands and

How to: Directly Execute Commands Against the Data Source

.NET Framework
Available since 4.0
Return to top
Show: