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

How to: Materialize Primitive Types

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 ( FluentModel dbContext = new FluentModel() )
   {
       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 FluentModel()
  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