mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-03 23:10:54 +08:00
update
@@ -77,17 +77,26 @@ new List<Song>(new[] { song1, song2, song3 })
|
|||||||
//v3.2.605+
|
//v3.2.605+
|
||||||
```
|
```
|
||||||
|
|
||||||
## Sub queryable ToList
|
## Subtable: ToList
|
||||||
|
|
||||||
> v3.2.650+
|
> v3.2.650+
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
fsql.Select<Song>().ToList(a => new
|
fsql.Select<Topic>().ToList(a => new
|
||||||
{
|
{
|
||||||
all = a,
|
all = a,
|
||||||
list1 = fsql.Select<Tag>().ToList(),
|
list1 = fsql.Select<T2>().ToList(),
|
||||||
list2 = fsql.Select<SongTag>().Where(b => b.SongId == a.Id).ToList()
|
list2 = fsql.Select<T2>().Where(b => b.TopicId == a.Id).ToList()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fsql.Select<Topic>()
|
||||||
|
.GroupBy(a => new { a.Author })
|
||||||
|
.WithTempQuery(a => new { Author = a.Key.Author, Count = a.Count() })
|
||||||
|
.ToList(a => new {
|
||||||
|
a.Author, a.Count,
|
||||||
|
list1 = fsql.Select<T2>().ToList(),
|
||||||
|
list2 = fsql.Select<T2>().Where(b => b.Author == a.Author).ToList()
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Comparison of the Two Ways of IncludeMany
|
## Comparison of the Two Ways of IncludeMany
|
||||||
|
|||||||
21
贪婪加载.md
21
贪婪加载.md
@@ -76,17 +76,26 @@ new List<Song>(new[] { song1, song2, song3 })
|
|||||||
//v3.2.605+
|
//v3.2.605+
|
||||||
```
|
```
|
||||||
|
|
||||||
## 5、子查询 ToList
|
## 5、子表ToList
|
||||||
|
|
||||||
> v3.2.650+ 以下最多执行3次 SQL
|
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
fsql.Select<Song>().ToList(a => new
|
//最多执行3次 SQL
|
||||||
|
fsql.Select<Topic>().ToList(a => new
|
||||||
{
|
{
|
||||||
all = a,
|
all = a,
|
||||||
list1 = fsql.Select<Tag>().ToList(),
|
list1 = fsql.Select<T2>().ToList(),
|
||||||
list2 = fsql.Select<SongTag>().Where(b => b.SongId == a.Id).ToList()
|
list2 = fsql.Select<T2>().Where(b => b.TopicId == a.Id).ToList()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//分组之后,最多执行3次 SQL
|
||||||
|
fsql.Select<Topic>()
|
||||||
|
.GroupBy(a => new { a.Author })
|
||||||
|
.WithTempQuery(a => new { Author = a.Key.Author, Count = a.Count() })
|
||||||
|
.ToList(a => new {
|
||||||
|
a.Author, a.Count,
|
||||||
|
list1 = fsql.Select<T2>().ToList(),
|
||||||
|
list2 = fsql.Select<T2>().Where(b => b.Author == a.Author).ToList()
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6、IncludeMany 两种方式对比
|
## 6、IncludeMany 两种方式对比
|
||||||
|
|||||||
Reference in New Issue
Block a user