Export (0) Print
Expand All

ObjectContext.Translate(Of TEntity) Method (DbDataReader, String, MergeOption)

Translates a DbDataReader that contains rows of entity data to objects of the requested entity type, in a specific entity set, and with the specified merge option.

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

Public Function Translate(Of TEntity) ( _
	reader As DbDataReader, _
	entitySetName As String, _
	mergeOption As MergeOption _
) As ObjectResult(Of TEntity)

Type Parameters



Type: System.Data.Common.DbDataReader

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

Type: System.String

The entity set of the TResult type.

Type: System.Data.Objects.MergeOption

The MergeOption to use when translated objects are added to the object context. The default is AppendOnly.

Return Value

Type: System.Data.Objects.ObjectResult(Of TEntity)
An enumeration of objects of type TResult.


When reader is Nothing.


When the supplied mergeOption is not a valid MergeOption value.


When the supplied entitySetName is not a valid entity set for the TResult type.

The Translate 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 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:

Executing Store Commands and

How to: Directly Execute Arbitrary Command Against the Store

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
© 2015 Microsoft