Data Access has been discontinued. Please refer to this page for more information.

How to: Materialize Primitive Types

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

This topic demonstrates how to materialize primitive types.

To run the samples in this topic, you need to use\import the System.Data, System.Data.Common and Telerik.OpenAccess.Data.Common namespaces.

Basically, you need to use the generic ExecuteQuery<T> method of the OpenAccessContext.

private static void MaterializeValueType()
{
   using ( EntitiesModel dbContext = new EntitiesModel() )
   {
       const string SqlQuery = "SELECT CategoryID FROM Categories";
       IList<int> result = dbContext.ExecuteQuery<int>( SqlQuery );
       foreach ( int id in result )
       {
           Console.WriteLine( id );
       }
   }
}
Private Sub MaterializeValueType()
 Using dbContext As New EntitiesModel()
  Dim sqlQuery As String = "SELECT CategoryID FROM Categories"
  Dim result As IList(Of Integer) = dbContext.ExecuteQuery(Of Integer)(sqlQuery)
  For Each id As Integer In result
   Console.WriteLine(id)
  Next id
 End Using
End Sub