ObjectContext.Translate(Of 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 Function Translate(Of TElement) (
	reader As DbDataReader
) As ObjectResult(Of TElement)


Type: System.Data.Common.DbDataReader

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

Return Value

Type: System.Data.Objects.ObjectResult(Of TElement)

An enumeration of objects of type TResult.

Type Parameters


The entity type of the data in the DbDataReader.

Exception Condition

When reader is null.

The Translate(Of 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(Of T) is executed to return entity data. The Translate(Of 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