mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-28 03:01:01 +08:00
update
8
动态操作.md
8
动态操作.md
@@ -96,9 +96,9 @@ fsql.Select<Region>().OrderBy("a.id desc") //提示:存在SQL注入安全问
|
||||
- 支持导航属性,比如 OrderByPropertyName("Parent.Code")
|
||||
- 支持多表查询,比如 OrderByPropertyName("b.Code")
|
||||
|
||||
## 动态贪婪加载 IncludeByPropertyName
|
||||
## 动态贪婪加载
|
||||
|
||||
ISelect.IncludeByPropertyName 方法实现动态贪婪加载,对应 Include/IncludeMany。
|
||||
1、ISelect.IncludeByPropertyName 方法实现动态贪婪加载,对应 Include/IncludeMany:
|
||||
|
||||
```csharp
|
||||
fsql.Select<Region>()
|
||||
@@ -111,7 +111,7 @@ fsql.Select<Region>()
|
||||
.ToList();
|
||||
```
|
||||
|
||||
List\<TDto\> 也支持贪婪加载,只支持 OneToMany:
|
||||
2、List\<TDto\>.IncludeByPropertyName 扩展方法也实现了 OneToMany 动态贪婪加载:
|
||||
|
||||
```csharp
|
||||
var dtos = fsql.Select<Region>().ToList<Dto>();
|
||||
@@ -120,7 +120,7 @@ var dtos = fsql.Select<Region>().ToList<Dto>();
|
||||
dtos.IncludeByPropertyName(
|
||||
orm: fsql,
|
||||
property: "Childs",
|
||||
where: "ParentId=Id",
|
||||
where: "ParentId=Id", //临时关系
|
||||
take: 5,
|
||||
select: "id,name",
|
||||
then => then.IncludeByPropertyName("Parent")
|
||||
|
||||
Reference in New Issue
Block a user