using System;
using System.Linq;
using Telerik.OpenAccess;

namespace _1_ORM_Reverse_Mapping
{
    class Program
    {
        static void Main(string[] args)
        {
            //using (IObjectScope scope = ObjectScopeProvider1.ObjectScope())
            //{
            //    Query<Customer> query =
            //      scope.GetSqlQuery<Customer>("select * from Customers", "");
            //    QueryResultList<Customer> customers = query.ExecuteList();
            //    foreach (Customer customer in customers)
            //    {
            //        Console.WriteLine("Customer: {0}:", customer.CompanyName);
            //        foreach (Order order in customer.Orders)
            //        {
            //            Console.WriteLine("\tOrder: {0}:", order.OrderID);
            //            foreach (OrderDetail orderDetail in order.OrderDetails)
            //            {
            //                Console.WriteLine("\t\tProduct: {0}:",
            //                  orderDetail.Product.ProductName);
            //            }
            //        }
            //    }
            //}
            //Console.ReadLine();

            using (IObjectScope scope1 = ObjectScopeProvider1.ObjectScope())
            {
                var results = from p in scope1.Extent<Customer>() select p;
                foreach (Customer c in results)
                {

                    Console.WriteLine(c.ContactName);
                }
            }
            Console.ReadLine();
        }
    }
}
