Uredi

Deli z drugimi prek


ObjectContext.Translate Method

Definition

Overloads

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.

Translate<TElement>(DbDataReader)

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

public:
generic <typename TElement>
 System::Data::Objects::ObjectResult<TElement> ^ Translate(System::Data::Common::DbDataReader ^ reader);
public System.Data.Objects.ObjectResult<TElement> Translate<TElement> (System.Data.Common.DbDataReader reader);
member this.Translate : System.Data.Common.DbDataReader -> System.Data.Objects.ObjectResult<'Element>
Public Function Translate(Of TElement) (reader As DbDataReader) As ObjectResult(Of TElement)

Type Parameters

TElement

The entity type of the data in the DbDataReader.

Parameters

reader
DbDataReader

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

Returns

ObjectResult<TElement>

An enumeration of objects of type TResult.

Exceptions

When reader is null.

Remarks

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

Directly Executing Store Commands and

How to: Directly Execute Commands Against the Data Source

Applies to

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.

public:
generic <typename TEntity>
 System::Data::Objects::ObjectResult<TEntity> ^ Translate(System::Data::Common::DbDataReader ^ reader, System::String ^ entitySetName, System::Data::Objects::MergeOption mergeOption);
public System.Data.Objects.ObjectResult<TEntity> Translate<TEntity> (System.Data.Common.DbDataReader reader, string entitySetName, System.Data.Objects.MergeOption mergeOption);
member this.Translate : System.Data.Common.DbDataReader * string * System.Data.Objects.MergeOption -> System.Data.Objects.ObjectResult<'Entity>
Public Function Translate(Of TEntity) (reader As DbDataReader, entitySetName As String, mergeOption As MergeOption) As ObjectResult(Of TEntity)

Type Parameters

TEntity

The entity type of the data in the DbDataReader.

Parameters

reader
DbDataReader

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

entitySetName
String

The entity set of the TEntity type.

mergeOption
MergeOption

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

Returns

ObjectResult<TEntity>

An enumeration of objects of type TResult.

Exceptions

When reader is null.

When the supplied mergeOption is not a valid MergeOption value.

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

Remarks

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

Directly Executing Store Commands and

How to: Directly Execute Commands Against the Data Source

Applies to