예제 #1
0
        public void LazyLoad()
        {
            _screenHelper.Reset();
            var sw = new Stopwatch();

            _screenHelper.PrintLazyLoading();
            using (var context = new DataContext())
            {
                sw.Start();
                var books = context.Books.ToList <Book>();

                foreach (var book in books)
                {
                    if (book.Reader?.Address?.Street != null)
                    {
                        Console.WriteLine(book.Reader.Address.Street);
                    }
                }

                sw.Stop();
            }

            _screenHelper.PrintElapsedTime(sw.Elapsed);

            _menuHelper.NavigateToMainMenu();
        }