1 / 8

Lazy Loading vs. Eager Loading

Lazy Loading vs. Eager Loading. Lazy Loading: Gerekeni, gerektiğinde getir. Eager Loading: Hepsini getir . Gerekenleri kullan. Lazy Loading vs. Eager Loading. Lazy Loading vs. Eager Loading. dbo.Categories. dbo.Suppliers. dbo.Products. SQL. SELECT * FROM Products p

grace
Download Presentation

Lazy Loading vs. Eager Loading

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lazy Loading vs. Eager Loading • Lazy Loading: Gerekeni, gerektiğinde getir. • Eager Loading: Hepsini getir. Gerekenleri kullan.

  2. Lazy Loading vs. Eager Loading

  3. Lazy Loading vs. Eager Loading

  4. dbo.Categories dbo.Suppliers dbo.Products

  5. SQL SELECT* FROMProducts p INNERJOINCategories c ONp.CategoryID=c.CategoryID INNERJOIN Suppliers s ON p.SupplierID = s.SupplierID

  6. Lazy Loading (EFFiltre.sln) privatevoid Form1_Load(object sender, EventArgs e) { NorthwindEntities db = newNorthwindEntities(); List<Product> urunler = db.Products.ToList(); //cmbKategoriler.DataSource = db.Categories.ToList(); ListViewDoldur(urunler); } privatevoid ListViewDoldur(List<Product> _gelenList) { NorthwindEntities db = newNorthwindEntities(); listViewUrunler.Items.Clear(); foreach (var item in _gelenList) { ListViewItem lw = newListViewItem(); lw.Text = item.ProductName; lw.SubItems.Add(item.Category.CategoryName); lw.SubItems.Add(item.UnitPrice.ToString()); lw.SubItems.Add(item.Supplier.CompanyName); lw.SubItems.Add(item.Supplier.City); listViewUrunler.Items.Add(lw); } } 151

  7. Eager Loading privatevoidbtnSelect_Click(object sender, EventArgs e) { NorthwindEntities db = newNorthwindEntities(); listViewUrunAyrinti.Items.Clear(); List<UrunAyrinti> uList = db.Products.Select(x => newUrunAyrinti() { UrunAd = x.ProductName, KategoriAd = x.Category.CategoryName, Fiyat = x.UnitPrice, TedarikciAd = x.Supplier.CompanyName, TedarikciSehir = x.Supplier.City }).ToList(); foreach (var item in uList) { ListViewItem lw = newListViewItem(); lw.Text = item.UrunAd; lw.SubItems.Add(item.KategoriAd); lw.SubItems.Add(item.Fiyat.ToString()); lw.SubItems.Add(item.TedarikciAd); lw.SubItems.Add(item.TedarikciSehir); listViewUrunAyrinti.Items.Add(lw); }

More Related