mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-06 16:30:52 +08:00
Updated Greed Loading (markdown)
@@ -14,6 +14,9 @@ Select<Tag>().Include(a => a.Parent.Parent).ToList(true);
|
||||
Select<Tag>().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<Tag>().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<Tag>().IncludeMany(a => a.Songs).ToList();
|
||||
|
||||
Select<Tag>().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.
|
||||
|
||||
Reference in New Issue
Block a user