Share via


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 virtual System.Data.Entity.Core.Objects.ObjectResult<TElement> Translate<TElement> (System.Data.Common.DbDataReader reader);
abstract member Translate : System.Data.Common.DbDataReader -> System.Data.Entity.Core.Objects.ObjectResult<'Element>
override this.Translate : System.Data.Common.DbDataReader -> System.Data.Entity.Core.Objects.ObjectResult<'Element>
Public Overridable Function Translate(Of TElement) (reader As DbDataReader) As ObjectResult(Of TElement)

Type Parameters

TElement

The entity type.

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.

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.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification="Generic parameters are required for strong-typing of the return type.")]
public virtual System.Data.Entity.Core.Objects.ObjectResult<TEntity> Translate<TEntity> (System.Data.Common.DbDataReader reader, string entitySetName, System.Data.Entity.Core.Objects.MergeOption mergeOption);
abstract member Translate : System.Data.Common.DbDataReader * string * System.Data.Entity.Core.Objects.MergeOption -> System.Data.Entity.Core.Objects.ObjectResult<'Entity>
override this.Translate : System.Data.Common.DbDataReader * string * System.Data.Entity.Core.Objects.MergeOption -> System.Data.Entity.Core.Objects.ObjectResult<'Entity>

Type Parameters

TEntity

The entity type.

Parameters

reader
DbDataReader

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

entitySetName
String

The entity set of the TResult 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 .

Attributes

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.

Applies to