From 3e3049d999e154b85639c2f40bc09ece392d737a Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@users.noreply.github.com> Date: Wed, 7 May 2025 12:27:46 +0800 Subject: [PATCH] Updated Greed Loading (markdown) --- Greed-Loading.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Greed-Loading.md b/Greed-Loading.md index 1864910..efcb485 100644 --- a/Greed-Loading.md +++ b/Greed-Loading.md @@ -14,6 +14,9 @@ Select().Include(a => a.Parent.Parent).ToList(true); Select().Where(a => a.Parent.Parent.Name == "1").ToList(true); //Write in this way, no need to mark Join, //it will be automatically processed into LeftJoin when parsing the expression + +Select().LeftJoin(a => a.Parent.Id == a.ParentId && a.Parent.xxx > 0).ToList(); +//Write this way to add filtering conditions to ManyToOne ``` ## Navigation Properties - OneToMany/ManyToMany @@ -22,6 +25,9 @@ IncludeMany greedily loads the navigation properties of the collection. In fact, ```csharp Select().IncludeMany(a => a.Songs).ToList(); + +Select().IncludeMany(a => a.Songs, then => then.Where(song => song.xxx > 0)).ToList(); +//Write this way to add filtering conditions to OneToMany/ManyToMany ``` IncludeMany has a second parameter, which can be modified before the second query.