ObjectContext::Translate Method
Translates the data from a DbDataReader into sequence of entities.
Assembly: EntityFramework (in EntityFramework.dll)
| Name | Description | |
|---|---|---|
![]() | Translate<TElement>(DbDataReader^) | Translates a DbDataReader that contains rows of entity data to objects of the requested entity type. |
![]() | Translate<TEntity>(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. |
ObjectContext::Translate<TElement> Method (DbDataReader^)
Translates a DbDataReader that contains rows of entity data to objects of the requested entity type.
public: generic<typename TElement> virtual ObjectResult<TElement>^ Translate( 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.Entity.Core.Objects::ObjectResult<TElement>^An enumeration of objects of type TResult .
Type Parameters
- TElement
The entity type.
| Exception | Condition |
|---|---|
| ArgumentNullException | When reader is null. |
ObjectContext::Translate<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.
public: generic<typename TEntity> [SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Generic parameters are required for strong-typing of the return type.")] virtual ObjectResult<TEntity>^ Translate( DbDataReader^ reader, String^ entitySetName, MergeOption mergeOption )
Parameters
- reader
-
Type:
System.Data.Common::DbDataReader^
The DbDataReader that contains entity data to translate into entity objects.
- entitySetName
-
Type:
System::String^
The entity set of the TResult type.
- mergeOption
-
Type:
System.Data.Entity.Core.Objects::MergeOption
The MergeOption to use when translated objects are added to the object context. The default is AppendOnly .
Return Value
Type: System.Data.Entity.Core.Objects::ObjectResult<TEntity>^An enumeration of objects of type TResult .
Type Parameters
- TEntity
The entity type.
| Exception | Condition |
|---|---|
| ArgumentNullException | When reader is null. |
| ArgumentOutOfRangeException | When the supplied mergeOption is not a valid MergeOption value. |
| InvalidOperationException | When the supplied entitySetName is not a valid entity set for the TResult type. |
