in FMLab/Odata4ConsoleApplication/Program.cs [91:115]
private static void GetAllCustomers()
{
//Using the DataServiceContext class, we can simply perform a LINQ query to retrieve all Customers from the Customer entity.
//This internally will issue web request by using the URI that represents OData protocol
//get all customers
var query = from customer in context.FleetCustomers
select customer;
Console.ForegroundColor = ConsoleColor.Cyan;
//Display the http request Uri that was sent to fetch all customers
Console.WriteLine("Request Uri: " + query.ToString());
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine();
//After retrieving all the customers, iterate through the collection and print each one.
foreach (FleetCustomer c in query)
{
Console.WriteLine("Customer.Driver License: " + c.DriverLicense);
Console.WriteLine("First Name: " + c.FirstName);
Console.WriteLine("Last Name: " + c.LastName);
Console.WriteLine("++++++++");
}
}