Quick Objects Documentation Akal Tech Logo
Selecting Records and using Anonymous Types

Glossary Item Box

Business Logic Framework - Tutorial 35:

Using LINQ with Quick Objects is very simple. Once you create an instance of any of the business objects, you can specify LINQ queries on that instance.  You can also use the regular object oriented API to specify the same query and switch back and forth between the two approach.  This sample shows a simple query that selects all records and uses an anonymous type definition and a ToList method call to execute the query immedietly.

using  (Orders orders =  new Orders())  
{  
    // Return selective fields  
    var result = (  
        from o  in orders  
        select  new { o.OrderAmount, o.OrderDate, o.OrderID }  
        ).ToList();  
    this.GridView1.DataSource = result;  
}  
 
Using orders As Orders = New Orders()  
            Dim result = (From o In orders _  
            Select New With {o.OrderAmount, o.OrderDate, o.OrderID}).ToList()  
 
            Me.GridView1.DataSource = result  
End Using