Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts an existing IDataReader to objects.
Translate(DbDataReader) |
Converts an existing DbDataReader to objects. |
Translate(Type, DbDataReader) |
Converts an existing DbDataReader to objects. |
Translate<TResult>(DbDataReader) |
Converts an existing DbDataReader to objects. |
Each row in the IDataReader is converted to an object in the IEnumerable<T>.
public IEnumerable<T> Translate<T>(IDataReader reader) {}
Description: This method is used to convert an existing DbDataReader to objects. Each row in the DbDataReader is converted to an object in the IEnumerable<T>.
Generic parameters:
T
: See ExecuteQuery.
Parameters:
Query
: See the description for command under ExecuteCommand.
Parameters
: See the description for parameters under ExecuteCommand.
Return type:
IEnumerable<T>: collection of objects returned by the conversion.
Converts an existing DbDataReader to objects.
public:
System::Data::Linq::IMultipleResults ^ Translate(System::Data::Common::DbDataReader ^ reader);
public System.Data.Linq.IMultipleResults Translate(System.Data.Common.DbDataReader reader);
member this.Translate : System.Data.Common.DbDataReader -> System.Data.Linq.IMultipleResults
Public Function Translate (reader As DbDataReader) As IMultipleResults
The IDataReader to be converted.
A list of objects returned by the conversion.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Converts an existing DbDataReader to objects.
public:
System::Collections::IEnumerable ^ Translate(Type ^ elementType, System::Data::Common::DbDataReader ^ reader);
public System.Collections.IEnumerable Translate(Type elementType, System.Data.Common.DbDataReader reader);
member this.Translate : Type * System.Data.Common.DbDataReader -> System.Collections.IEnumerable
Public Function Translate (elementType As Type, reader As DbDataReader) As IEnumerable
The type of the IEnumerable<T> to be returned.
The algorithm for matching columns in the result to fields and properties in the object works as follows:
If a field or property is mapped to a particular column name, that column name is expected in the resultset.
If a field or property is not mapped, a column with the same name as the field or property is expected in the resultset.
The comparison is performed by looking for a case-sensitive match first. If this match is not found, a subsequent search is occurs for a case-insensitive match.
The query must return all the tracked fields and properties of the object (except those that are loaded on a deferred basis) when all the following conditions are true:
T
is an entity explicitly tracked by the DataContext.
ObjectTrackingEnabled is true
.
The entity has a primary key.
Otherwise an exception is thrown.
The IDataReader to be converted.
A list of objects returned by the conversion.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Converts an existing DbDataReader to objects.
public:
generic <typename TResult>
System::Collections::Generic::IEnumerable<TResult> ^ Translate(System::Data::Common::DbDataReader ^ reader);
public System.Collections.Generic.IEnumerable<TResult> Translate<TResult>(System.Data.Common.DbDataReader reader);
member this.Translate : System.Data.Common.DbDataReader -> seq<'Result>
Public Function Translate(Of TResult) (reader As DbDataReader) As IEnumerable(Of TResult)
The type of the IEnumerable<T> to be returned.
The IDataReader to be converted.
A collection of objects returned by the conversion.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Please sign in to use this experience.
Sign in