Querying Saved Data

In the client console application replace the code with the following code:

static void Main(string[] args)
{
    PersistenceManager pm = new PersistenceManager();
    Employee emp = pm.Objects<Employee>().Single();
    System.Console.WriteLine($"{emp.FirstName} {emp.LastName}"); // C# 6.0
}

pm.Objects<T> is a virtual table for all objects of type T. Single() selects the one object of the table. More information about queries can be found in the Chapter Queries with NDOql and Linq.

Note that NDO also provides a generic query object for the NDOQl language:

using System.Collections.Generic;
...
NDOQuery<Employee> q = new NDOQuery<Employee>(pm);
List<Employee> lstEmployee = q.Execute();
Console.WriteLine(lstEmployee[0].FirstName + " " + lstEmployee[0].LastName);