From c4fd9286efff605263ea7f3a5246d998fce2ce1f Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Fri, 28 Aug 2020 22:04:43 +0800 Subject: [PATCH] update --- AOP.md | 2 +- DbContext.md | 2 +- Home.md | 2 +- Repository.md | 2 +- _Sidebar.md | 2 +- 事务.md | 2 +- 分区分表.md | 109 ---------------------------------------- 分库分表.md | 129 ++++++++++++++++++++++++++++++++++++++++++++++++ 分页查询.md | 2 +- 单表查询.md | 2 +- 多表查询.md | 2 +- 安装.md | 2 +- 工作单元.md | 2 +- 性能.md | 2 +- 查询.md | 2 +- 查询父子关系.md | 2 +- 添加.md | 2 +- 租户.md | 2 +- 读写分离.md | 2 +- 过滤器.md | 2 +- 返回数据.md | 2 +- 21 files changed, 148 insertions(+), 128 deletions(-) delete mode 100644 分区分表.md create mode 100644 分库分表.md diff --git a/AOP.md b/AOP.md index 1ae57d6..69872cd 100644 --- a/AOP.md +++ b/AOP.md @@ -135,6 +135,6 @@ fsql.Aop.ParseExpression += (s, e) => { * [《CodeFirst模式之四:类型映射》](https://github.com/2881099/FreeSql/wiki/%e7%b1%bb%e5%9e%8b%e6%98%a0%e5%b0%84) * [《CodeFirst模式之五:迁移结构》](https://github.com/2881099/FreeSql/wiki/CodeFirst#%e8%bf%81%e7%a7%bb%e7%bb%93%e6%9e%84) - [《DbFirst模式开发介绍》](https://github.com/2881099/FreeSql/wiki/DbFirst) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) \ No newline at end of file diff --git a/DbContext.md b/DbContext.md index 5af0a1a..dbd26a3 100644 --- a/DbContext.md +++ b/DbContext.md @@ -272,7 +272,7 @@ DbContext.SaveChanges,或者 Repository 对实体的 Insert/Update/Delete, ## 参考资料 -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) - [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) diff --git a/Home.md b/Home.md index b27ac26..4611b79 100644 --- a/Home.md +++ b/Home.md @@ -53,7 +53,7 @@ FreeSql是一个功能强大的 .NET ORM 功能库,支持 .NetFramework 4.0+ * [过滤器](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) * [AOP✨](https://github.com/2881099/FreeSql/wiki/AOP) * [读写分离](https://github.com/2881099/FreeSql/wiki/%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb) -* [分区分表](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +* [分库分表](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) * [租户](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) * [性能](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) * [*你不知道的功能✨*](https://github.com/2881099/FreeSql/wiki/%E9%AA%9A%E6%93%8D%E4%BD%9C) diff --git a/Repository.md b/Repository.md index 75e6868..0fbe48c 100644 --- a/Repository.md +++ b/Repository.md @@ -182,7 +182,7 @@ SqlServer 提供的 output inserted 特性,在表使用了自增或数据库 - [《学习FreeSql之四:查询数据》](https://github.com/2881099/FreeSql/wiki/%e6%9f%a5%e8%af%a2) - [《优化之:延时加载》](https://github.com/2881099/FreeSql/wiki/%e5%bb%b6%e6%97%b6%e5%8a%a0%e8%bd%bd) - [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) - [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) diff --git a/_Sidebar.md b/_Sidebar.md index e0eb3fa..5f085e6 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -41,7 +41,7 @@ * [过滤器](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) * [AOP✨](https://github.com/2881099/FreeSql/wiki/AOP) * [读写分离](https://github.com/2881099/FreeSql/wiki/%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb) -* [分区分表](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +* [分库分表](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) * [租户](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) * [性能](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) * [*你不知道的功能✨*](https://github.com/2881099/FreeSql/wiki/%E9%AA%9A%E6%93%8D%E4%BD%9C) diff --git a/事务.md b/事务.md index f3b6c9d..feff513 100644 --- a/事务.md +++ b/事务.md @@ -153,7 +153,7 @@ using (var uowManager = new UnitOfWorkManager(fsql)) //使用 UnitOfWorkManager - [《租户》](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/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) - [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) diff --git a/分区分表.md b/分区分表.md deleted file mode 100644 index df0cbaa..0000000 --- a/分区分表.md +++ /dev/null @@ -1,109 +0,0 @@ -## 分区 - -分区就是把一个数据表的文件和索引分散存储在不同的物理文件中。把一张表的数据分成N多个区块,这些区块可以在同一个磁盘上,也可以在不同的磁盘上,数据库不同实现方式有所不同。 - -与分表不同,一张大表进行分区后,他还是一张表,不会变成二张表,但是他存放数据的区块变多了。分区的概念,我觉得就想突破磁盘I/O瓶颈,想提高磁盘的读写能力,来增加数据库的性能。 - -分区实现是比较简单的,建立分区表,根建平常的表没什么区别,并且对开发代码端来说是透明。 - -postgresql10以上的自动分区分表功能: - -1、首先创建主分区表: -```sql -create table fenbiao( -id int, -year varchar -) partition by list(year) -``` - -这里设置的是根据year列进行数据分表;创建后使用navicat是看不到的; - -2.创建分表: -```sql -create table fenbiao_2017 partition of fenbiao for values in ('2017'); -create table fenbiao_2018 partition of fenbiao for values in ('2018'); -``` - -这样这两天数据会依靠规则插入到不同分表中,如果插入一条不符合规则的数据,则会报错误:no partition of relation "fenbiao" found for row. - -## 分表 - -分表从表面意思上看呢,就是把一张表分成N多个小表,每一个小表都是完正的一张表。分表后数据都是存放在分表里,总表只是一个外壳,存取数据发生在一个一个的分表里面。 - -分表后单表的并发能力提高了,磁盘I/O性能也提高了。并发能力为什么提高了呢,因为查寻一次所花的时间变短了,如果出现高并发的话,总表可以根据不同 的查询,将并发压力分到不同的小表里面。 - -## 分库分表 - -分库分表把原本存储于一个库的数据分块存储到多个库上,把原本存储于一个表的数据分块存储到多个表上。 - -数据库中的数据量不一定是可控的,在未进行分库分表的情况下,随着时间和业务的发展,库中的表会越来越多,表中的数据量也会越来越大,相应地,数据操作,增删改查的开销也会越来越大;另外,一台服务器的资源(CPU、磁盘、内存、IO等)是有限的,最终数据库所能承载的数据量、数据处理能力都将遭遇瓶颈。 - -## FreeSql.Repository 分表 - -FreeSql 提供 AsTable 分表的基础方法,GuidRepository 作为分存式仓储将实现了分表与分库(不支持跨服务器分库)的封装。 - -```csharp -var logRepository = fsql.GetGuidRepository(null, oldname => $"{oldname}_201903"); -``` - -上面我们得到一个日志仓储按年月分表,使用它 CURD 最终会操作 Log_201903 表。 - -注意事项: - -* v0.11.12以后的版本可以使用 CodeFirst 迁移分表; -* 不可在分表分库的实体类型中使用《延时加载》; - -## 跨表查询 - -```csharp -var sql = fsql.Select() - .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().LeftJoin((a,b) => a.UserGroupId == b.Id) - .AsTable((type, oldname) => oldname + "_1") - .AsTable((type, oldname) => oldname + "_2") - .AsTable((type, oldname) => oldname + "_3") - .ToSql(a => a.Id); -``` - -> 期待更多发散。。。 - -## 巧用AsTable -```csharp -var sql = fsql.Select() - .AsTable((a, b) => "(select * from tb_topic where clicks > 10)") - .Page(1, 10).ToList() -``` -> v1.0.1 ISelect 增加 WithSql("select * from user ...") 功能快速代理此方法 - -## 分库跨库 - -参数资料:[https://github.com/dotnetcore/FreeSql/issues/44](https://github.com/dotnetcore/FreeSql/issues/44) - -- [《租户》](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) -- [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) -- [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) -- [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) -- [《UnitOfWork》](https://github.com/2881099/FreeSql/wiki/%e5%b7%a5%e4%bd%9c%e5%8d%95%e5%85%83) -- [《学习FreeSql之一:添加数据》](https://github.com/2881099/FreeSql/wiki/%e6%b7%bb%e5%8a%a0) -- [《学习FreeSql之二:删除数据》](https://github.com/2881099/FreeSql/wiki/%e5%88%a0%e9%99%a4) -- [《学习FreeSql之三:修改数据》](https://github.com/2881099/FreeSql/wiki/%e4%bf%ae%e6%94%b9) -- [《优化之:延时加载》](https://github.com/2881099/FreeSql/wiki/%e5%bb%b6%e6%97%b6%e5%8a%a0%e8%bd%bd) -- [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) \ No newline at end of file diff --git a/分库分表.md b/分库分表.md new file mode 100644 index 0000000..7b90656 --- /dev/null +++ b/分库分表.md @@ -0,0 +1,129 @@ +## 理论知识 + +分表 - 从表面意思上看呢,就是把一张表分成N多个小表,每一个小表都是完正的一张表。分表后数据都是存放在分表里,总表只是一个外壳,存取数据发生在一个一个的分表里面。分表后单表的并发能力提高了,磁盘I/O性能也提高了。并发能力为什么提高了呢,因为查寻一次所花的时间变短了,如果出现高并发的话,总表可以根据不同 的查询,将并发压力分到不同的小表里面。 + +分库 - 把原本存储于一个库的数据分块存储到多个库上,把原本存储于一个表的数据分块存储到多个表上。数据库中的数据量不一定是可控的,在未进行分库分表的情况下,随着时间和业务的发展,库中的表会越来越多,表中的数据量也会越来越大,相应地,数据操作,增删改查的开销也会越来越大;另外,一台服务器的资源(CPU、磁盘、内存、IO等)是有限的,最终数据库所能承载的数据量、数据处理能力都将遭遇瓶颈。 + +## 分表 AsTable + +FreeSql 原生用法、FreeSql.Repository 仓储用法 都提供了 AsTable 方法对分表进行 CRUD 操作,例如: + +```c# +var repo = fsql.GetRepository(); +repo.AsTable(_ => $"{oldname}_201903"); //对 Log_201903 表 CRUD + +repo.Insert(new Log { ... }); +``` + +跨库,但是在同一个数据库服务器下,也可以使用 AsTable(_ => $"db2.dbo.{oldname}_201903") + +```csharp +//跨表查询 +var sql = fsql.Select() + .AsTable((type, oldname) => "table_1") + .AsTable((type, oldname) => "table_2") + .ToSql(a => a.Id); + +//select * from (SELECT a."Id" as1 FROM "table_1" a) ftb +//UNION ALL +//select * from (SELECT a."Id" as1 FROM "table_2" a) ftb +``` + +分表总结: + +- 分表、相同服务器跨库 可以使用 AsTable 进行 CRUD; +- AsTable CodeFirst 会自动创建不存在的分表; +- 不可在分表分库的实体类型中使用《延时加载》; + +## 分库 IdleBus + +IFreeSql 对应一个数据库,分库是不是要定义N个 IFreeSql?分库的租户场景,那不要定义10000个? + +IdleBus 空闲对象管理容器,有效组织对象重复利用,自动创建、销毁,解决【实例】过多且长时间占用的问题。有时候想做一个单例对象重复使用提升性能,但是定义多了,有的又可能一直空闲着占用资源。专门解决:又想重复利用,又想少占资源的场景。https://github.com/2881099/IdleBus + +> dotnet add package IdleBus + +```csharp +static IdleBus ib = new IdleBus(TimeSpan.FromMinutes(10)); + +ib.Register("db1", () => new FreeSqlBuilder().UseConnectionString(DataType.MySql, "str1").Build()); +ib.Register("db2", () => new FreeSqlBuilder().UseConnectionString(DataType.MySql, "str2").Build()); +ib.Register("db3", () => new FreeSqlBuilder().UseConnectionString(DataType.SqlServer, "str3").Build()); +//...注册很多个 + +ib.Get("db1").Select().Limit(10).ToList(); +``` +IdleBus 也是【单例】设计!主要的两个方法,注册,获取。使用 IdleBus 后应需要弱化 IFreeSql 的存在。 + +```csharp +public static class IdleBusExtesions +{ + static AsyncLocal asyncLocalTenantId = new AsyncLocal(); + public static IdleBus ChangeTenant(this IdleBus ib, string tenantId) + { + asyncLocalTenantId.Value = tenantId; + return ib; + } + public static IFreeSql Get(this IdleBus ib) => ib.Get(asyncLocalTenantId.Value ?? "db1"); + public static IBaseRepository GetRepository(this IdleBus ib) where T : class => ib.Get().GetRepository(); + + //------------------------------------------------------- + + static void test() + { + IdleBus ib = null; //单例注入 + + var fsql = ib.Get(); //获取当前租户对应的 IFreeSql + + var fsql00102 = ib.ChangeTenant("00102").Get(); //切换租户,后面的操作都是针对 00102 + + var songRepository = ib.GetRepository(); + var detailRepository = ib.GetRepository(); + } + + //------------------------------------------------------- + + public static IServiceCollection AddIdleBusRepository(this IServiceCollection services, IdleBus ib, params Assembly[] assemblies) + { + services.AddSingleton(ib); + services.AddScoped(typeof(IBaseRepository<>), typeof(YourDefaultRepository<>)); + services.AddScoped(typeof(BaseRepository<>), typeof(YourDefaultRepository<>)); + services.AddScoped(typeof(IBaseRepository<,>), typeof(YourDefaultRepository<,>)); + services.AddScoped(typeof(BaseRepository<,>), typeof(YourDefaultRepository<,>)); + + if (assemblies?.Any() == true) + foreach (var asse in assemblies) //批量注册 + foreach (var repo in asse.GetTypes().Where(a => a.IsAbstract == false && typeof(IBaseRepository).IsAssignableFrom(a))) + services.AddScoped(repo); + return services; + } +} + +class YourDefaultRepository : BaseRepository where T : class +{ + public YourDefaultRepository(IdleBus ib) : base(ib.Get(), null, null) { } +} +class YourDefaultRepository : BaseRepository where T : class +{ + public YourDefaultRepository(IdleBus ib) : base(ib.Get(), null, null) { } +} +``` + +分表总结: + +- 跨库 可以使用 ib.Get() 获取 IFreeSql 进行 CRUD; +- 跨库 事务不好处理,注意了; +- 跨库 查询不好处理,注意了; + +- [《租户》](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) +- [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) +- [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) +- [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) +- [《UnitOfWork》](https://github.com/2881099/FreeSql/wiki/%e5%b7%a5%e4%bd%9c%e5%8d%95%e5%85%83) +- [《学习FreeSql之一:添加数据》](https://github.com/2881099/FreeSql/wiki/%e6%b7%bb%e5%8a%a0) +- [《学习FreeSql之二:删除数据》](https://github.com/2881099/FreeSql/wiki/%e5%88%a0%e9%99%a4) +- [《学习FreeSql之三:修改数据》](https://github.com/2881099/FreeSql/wiki/%e4%bf%ae%e6%94%b9) +- [《优化之:延时加载》](https://github.com/2881099/FreeSql/wiki/%e5%bb%b6%e6%97%b6%e5%8a%a0%e8%bd%bd) +- [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) \ No newline at end of file diff --git a/分页查询.md b/分页查询.md index 27ef2e7..32b8b97 100644 --- a/分页查询.md +++ b/分页查询.md @@ -59,4 +59,4 @@ SqlServer 2012+ 版本,使用最新的 fetch next rows 分页; - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) diff --git a/单表查询.md b/单表查询.md index 35fc3b2..f41292f 100644 --- a/单表查询.md +++ b/单表查询.md @@ -60,5 +60,5 @@ fsql.Select() - [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) \ No newline at end of file diff --git a/多表查询.md b/多表查询.md index 02312ae..5494269 100644 --- a/多表查询.md +++ b/多表查询.md @@ -219,5 +219,5 @@ WHERE t1.IsDeleted = 0 - [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) \ No newline at end of file diff --git a/安装.md b/安装.md index b340afe..e6ef296 100644 --- a/安装.md +++ b/安装.md @@ -59,7 +59,7 @@ FreeSql 除了支持基本的增删查改功能外,还支持基于现有数据 - [《数据库事务》](https://github.com/2881099/FreeSql/wiki/%e4%ba%8b%e5%8a%a1) - [《使用读写分离》](https://github.com/2881099/FreeSql/wiki/%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) - [《返回数据》](https://github.com/2881099/FreeSql/wiki/%e8%bf%94%e5%9b%9e%e6%95%b0%e6%8d%ae) - [《优化之:延时加载》](https://github.com/2881099/FreeSql/wiki/%e5%bb%b6%e6%97%b6%e5%8a%a0%e8%bd%bd) diff --git a/工作单元.md b/工作单元.md index f81e067..cba1ab1 100644 --- a/工作单元.md +++ b/工作单元.md @@ -120,7 +120,7 @@ DbContext.SaveChanges,或者 Repository 对实体的 Insert/Update/Delete, - [《租户》](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/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) - [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) diff --git a/性能.md b/性能.md index 6d26c7d..39dfbd0 100644 --- a/性能.md +++ b/性能.md @@ -204,7 +204,7 @@ public void QueryList() { - [《数据库事务》](https://github.com/2881099/FreeSql/wiki/%e4%ba%8b%e5%8a%a1) - [《使用读写分离》](https://github.com/2881099/FreeSql/wiki/%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) - [《返回数据》](https://github.com/2881099/FreeSql/wiki/%e8%bf%94%e5%9b%9e%e6%95%b0%e6%8d%ae) - [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) diff --git a/查询.md b/查询.md index 15ac4ab..31471b3 100644 --- a/查询.md +++ b/查询.md @@ -13,7 +13,7 @@ FreeSql在查询数据下足了功夫,链式查询语法、多表查询、表 - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《读写分离》](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) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) ## 特别介绍 WhereDynamicFilter diff --git a/查询父子关系.md b/查询父子关系.md index c28fa96..a9fefcb 100644 --- a/查询父子关系.md +++ b/查询父子关系.md @@ -216,5 +216,5 @@ Assert.Equal("中国[100000] -> 北京[110000] -> 东城区[110101]", t4[3].path - [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) \ No newline at end of file diff --git a/添加.md b/添加.md index 060dcd5..7d8cb43 100644 --- a/添加.md +++ b/添加.md @@ -177,7 +177,7 @@ fsql.Insert().MySqlIgnoreInto().AppendData(items).ExecuteAffrows(); - [《学习FreeSql之三:查询数据》](https://github.com/2881099/FreeSql/wiki/%e6%9f%a5%e8%af%a2) - [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) ## API diff --git a/租户.md b/租户.md index d2cc9ee..a22dbda 100644 --- a/租户.md +++ b/租户.md @@ -68,7 +68,7 @@ var reposTopic = orm.GetGuidRepository(null, oldname => $"{oldname}{tenan ### 方案三:按租户分库 -与方案二相同,只是表存储的位置不同,请查看 [《FreeSql.Repository 仓储》](https://github.com/2881099/FreeSql/wiki/Repository)、[《分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8)。 +与方案二相同,只是表存储的位置不同,请查看 [《FreeSql.Repository 仓储》](https://github.com/2881099/FreeSql/wiki/Repository)、[《分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93)。 ### 多表查询 diff --git a/读写分离.md b/读写分离.md index 79f7220..81e40e0 100644 --- a/读写分离.md +++ b/读写分离.md @@ -39,7 +39,7 @@ fsql.Select().Master().WhereId(a => a.Id == 1).ToOne(); //强制读【主库 * [《CodeFirst模式之四:类型映射》](https://github.com/2881099/FreeSql/wiki/%e7%b1%bb%e5%9e%8b%e6%98%a0%e5%b0%84) * [《CodeFirst模式之五:迁移结构》](https://github.com/2881099/FreeSql/wiki/CodeFirst#%e8%bf%81%e7%a7%bb%e7%bb%93%e6%9e%84) - [《DbFirst模式开发介绍》](https://github.com/2881099/FreeSql/wiki/DbFirst) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《过滤器、全局过滤器》](https://github.com/2881099/FreeSql/wiki/%e8%bf%87%e6%bb%a4%e5%99%a8) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) - [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) \ No newline at end of file diff --git a/过滤器.md b/过滤器.md index 300f167..587458a 100644 --- a/过滤器.md +++ b/过滤器.md @@ -152,7 +152,7 @@ repo1.Select.ToSql() - [《租户》](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/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《AOP》](https://github.com/2881099/FreeSql/wiki/AOP) - [《仓储层Repository》](https://github.com/2881099/FreeSql/wiki/Repository) - [《UnitOfWork》](https://github.com/2881099/FreeSql/wiki/%e5%b7%a5%e4%bd%9c%e5%8d%95%e5%85%83) diff --git a/返回数据.md b/返回数据.md index 2ea054c..a0afc20 100644 --- a/返回数据.md +++ b/返回数据.md @@ -173,5 +173,5 @@ A, B, C 都有 id,Dto { id, a1, a2, b1, b2 },A.id 被映射。也可以指 - [《优化之:贪婪加载》](https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd) - [《Expression 表达式函数》](https://github.com/2881099/FreeSql/wiki/%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%bd%e6%95%b0) - [《性能》](https://github.com/2881099/FreeSql/wiki/%e6%80%a7%e8%83%bd) -- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e5%8c%ba%e5%88%86%e8%a1%a8) +- [《分区、分表、分库》](https://github.com/2881099/FreeSql/wiki/%e5%88%86%e8%a1%a8%e5%88%86%e5%ba%93) - [《租户》](https://github.com/2881099/FreeSql/wiki/%e7%a7%9f%e6%88%b7) \ No newline at end of file