mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-12 03:10:57 +08:00
update
30
分区分表.md
30
分区分表.md
@@ -61,6 +61,36 @@ fsql.GetGuidRepository<User>().Select.FromRepository(logRepository)
|
||||
* 不能使用 CodeFirst 迁移分表,开发环境时仍然可以迁移 Log 表;
|
||||
* 不可在分表分库的实体类型中使用《延时加载》;
|
||||
|
||||
## 跨表查询
|
||||
|
||||
```csharp
|
||||
var sql = fsql.Select<User>()
|
||||
.AsTable((type, oldname) => "table_1")
|
||||
.AsTable((type, oldname) => "table_2")
|
||||
.AsTable((type, oldname) => "table_3")
|
||||
.ToSql(a => a.Id);
|
||||
```
|
||||
|
||||
得到SQL:
|
||||
```sql
|
||||
select * from (SELECT a."Id" as1 FROM "table_1" a) ftb
|
||||
UNION ALL
|
||||
select * from (SELECT a."Id" as1 FROM "table_2" a) ftb
|
||||
UNION ALL
|
||||
select * from (SELECT a."Id" as1 FROM "table_3" a) ftb
|
||||
```
|
||||
|
||||
多表查询:
|
||||
```csharp
|
||||
var sql = fsql.Select<User>().LeftJoin<UserGroup>((a,b) => a.UserGroupId == b.Id)
|
||||
.AsTable((type, oldname) => "table_1")
|
||||
.AsTable((type, oldname) => "table_2")
|
||||
.AsTable((type, oldname) => "table_3")
|
||||
.ToSql(a => a.Id);
|
||||
```
|
||||
|
||||
> 期待更多发散。。。
|
||||
|
||||
- [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7)
|
||||
- [《读写分离》](https://github.com/2881099/FreeSql/wiki/%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb)
|
||||
- [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd)
|
||||
|
||||
3
更新日志.md
3
更新日志.md
@@ -3,7 +3,10 @@
|
||||
|
||||
## v0.9.8
|
||||
|
||||
- 增加 AsTable 多次,可查询分表后的多个子表记录,以 UNION ALL 形式执行;
|
||||
- 完善 ExpressionTree DateTime/DateTimeOffset 数据转换测试;
|
||||
- 优化 ISelect`1.Include之后ToList参数includeNestedMembers默认为true;
|
||||
- 修复 属性无set自动忽略的bug;
|
||||
|
||||
## v0.9.7
|
||||
|
||||
|
||||
Reference in New Issue
Block a user