Ejemplo n.º 1
0
        public static void FastVersion()
        {
            using (var telerikAcademy = new TelerikAcademyDB())
            {
                telerikAcademy.Employees.Count();

                var sw = new Stopwatch();
                sw.Start();
                var employees = telerikAcademy.Employees.Select(empl => empl.Address).Select(address => address.Town).Where(city => city.Name == "Sofia");
                Console.WriteLine(sw.Elapsed);
                sw.Stop();
                Console.WriteLine("Count of employees in Sofia: " + employees.Count());
            }
        }
Ejemplo n.º 2
0
        public static void WithoutInclude()
        {
            using (var telerikAcademy = new TelerikAcademyDB())
            {
                telerikAcademy.Employees.Count();

                Stopwatch sw = new Stopwatch();
                sw.Start();

                var employees = telerikAcademy.Employees;
                Console.WriteLine(sw.Elapsed);

                sw.Restart();

                Console.WriteLine("Full Name\t Department Name\t Town Name");
                foreach (var employee in telerikAcademy.Employees)
                {
                    Console.WriteLine("{0} {1}\t {2}\t {3}", employee.FirstName, employee.LastName, employee.Department.Name, employee.Address.Town.Name);
                }

                Console.WriteLine(sw.Elapsed);
            }
        }