Querying the saved Data

The objects can be retrieved from the database with the following code:

foreach (Employee e in pm.Objects<Employee>().ResultTable)
{
    Console.WriteLine(e.FirstName + " " + e.LastName + ", " + e.Address.City);
    foreach (Travel t in e.Travels)
        Console.WriteLine(" Travel: " + t.Purpose);
}

You receive the following output:

John Doe, Dreamcity

  Travel: Inhouse-Training

  Travel: TechEd 2006

Press any key to continue

This solution is part of the tutorial samples. You can find the tutorial source code in the Tutorial folder beneath your NDO installation folder. The code up to here is placed in the Directory NDOTravelExpenses-Step 3.

The next tutorial section covers n:n relations.