mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-05 07:50:52 +08:00
update
@@ -137,7 +137,7 @@ FreeSql 是一款功能强大的对象关系映射(O/RM)组件,支持 .NET
|
||||
- ✒ 支持 丰富的表达式函数,以及灵活的自定义解析;
|
||||
- 🏁 支持 导航属性一对多、多对多贪婪加载,以及延时加载;
|
||||
- 📃 支持 读写分离、分表分库、过滤器、乐观锁、悲观锁;
|
||||
- 🌳 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/翰高/华为GaussDB/Access 等数据库;
|
||||
- 🌳 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/南大通用/翰高/Access 等数据库;
|
||||
|
||||
#### 基础
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ FreeSql 不愿做自己发光的金子,希望在 2020年 写下这篇完整一
|
||||
| 生命周期 | Singleton | Scoped | Scoped |
|
||||
| 使用方式 | IFreeSql、Repository | DbContext | SugarClient |
|
||||
|
||||
FreeSql .NET ORM 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/翰高/华为GaussDB/Access。
|
||||
FreeSql .NET ORM 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/南大通用/翰高/Access。
|
||||
|
||||
.NET ORM 各有自已看家本领,本文主要按 FreeSql 提供的功能进行列举比较,如有冒犯请见谅,也欢迎向 FreeSql 提出功能建议。
|
||||
|
||||
|
||||
@@ -180,6 +180,7 @@ fsql.Delete<Blog>()
|
||||
| DataType.Dameng(达梦) | server=127.0.0.1;port=5236;user id=2user;password=123456789;database=2user;poolsize=5 |
|
||||
| DataType.ShenTong(神通) | HOST=192.168.164.10;PORT=2003;DATABASE=OSRDB;USERNAME=SYSDBA;PASSWORD=szoscar55;MAXPOOLSIZE=2 |
|
||||
| DataType.KingbaseES(人大金仓) | Server=127.0.0.1;Port=54321;UID=USER2;PWD=123456789;database=TEST;MAXPOOLSIZE=2 |
|
||||
| DataType.Gbase(南大通用) | Driver={GBase ODBC DRIVER (64-Bit)};Host=192.168.164.134;Service=9088;Server=gbase01;Database=testdb;Protocol=onsoctcp;Uid=gbasedbt;Pwd=GBase123;Db_locale=zh_CN.utf8;Client_locale=zh_CN.utf8 |
|
||||
| DataType.OdbcMySql | Driver={MySQL ODBC 8.0 Unicode Driver}; Server=127.0.0.1;Persist Security Info=False; Trusted_Connection=Yes;UID=root;PWD=root; DATABASE=cccddd_odbc;Charset=utf8; SslMode=none;Min Pool Size=1 |
|
||||
| DataType.OdbcSqlServer | Driver={SQL Server};Server=.;Persist Security Info=False; Trusted_Connection=Yes;Integrated Security=True; DATABASE=freesqlTest_odbc; Pooling=true;Min Pool Size=1 |
|
||||
| DataType.OdbcOracle | Driver={Oracle in XE};Server=//127.0.0.1:1521/XE; Persist Security Info=False; Trusted_Connection=Yes;UID=odbc1;PWD=123456; Min Pool Size=1 |
|
||||
|
||||
2
Home.md
2
Home.md
@@ -21,7 +21,7 @@ QQ Groups:4336577(full)、8578575(full)、**52508226(available)**
|
||||
- 🌲 Support expression functions, and customizable analysis.
|
||||
- 🏁 Support one-to-many and many-to-many navigation properties, include and lazy loading.
|
||||
- 📃 Support Read/Write separation, Splitting Table/Database, Global filters, Optimistic and pessimistic locker.
|
||||
- 🌳 Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/翰高/华为GaussDB/Access, etc.
|
||||
- 🌳 Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/南大通用/翰高/Access, etc.
|
||||
|
||||
## Guide
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ If you do not design an infinite level classification table with data redundancy
|
||||
| (Optional) pathSeparator | Set the connector of `pathSelector`, default: `->` |
|
||||
| (Optional) level | Set recursion level |
|
||||
|
||||
> Databases that have passed the test: MySql8.0, SqlServer, PostgreSQL, Oracle, Sqlite, Firebird, 达梦, 人大金仓 and 翰高.
|
||||
> Databases that have passed the test: MySql8.0, SqlServer, PostgreSQL, Oracle, Sqlite, Firebird, 达梦, 人大金仓, 神舟通用, 南大通用 and 翰高.
|
||||
|
||||
Practice 1: AsTreeCte() + ToTreeList
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ var logRepository = fsql.GetGuidRepository<Log>(null, oldname => $"{oldname}_{Da
|
||||
|
||||
SqlServer 提供的 output inserted 特性,在表使用了自增或数据库定义了默认值的时候,使用它可以快速将 insert 的数据返回。PostgreSQL 也有相应的功能,如此方便但不是每个数据库都支持。
|
||||
|
||||
当采用了不支持该特性的数据库(Sqlite/MySql/Oracle/达梦/MsAccess),并且实体使用了自增属性,仓储批量插入将变为逐条执行,可以考虑以下改进:
|
||||
当采用了不支持该特性的数据库(Sqlite/MySql/Oracle/达梦/南大通用/MsAccess),并且实体使用了自增属性,仓储批量插入将变为逐条执行,可以考虑以下改进:
|
||||
|
||||
* 使用 uuid 作为主键(即 Guid);
|
||||
* 避免使用数据库的默认值功能;
|
||||
|
||||
3
入门.md
3
入门.md
@@ -2,7 +2,7 @@
|
||||
|
||||
FreeSql 是功能强大的 **.NET ORM**,支持 *.NET Framework 4.0+*、*.NET Core 2.1+*、*Xamarin* 等支持 *.NET Standard* 的所有运行平台。
|
||||
|
||||
支持 `MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/神通/人大金仓/翰高/华为GaussDB/MsAccess` 数据库。
|
||||
支持 `MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/南大通用/翰高/MsAccess` 数据库。
|
||||
|
||||
QQ群:4336577(已满)、8578575(已满)、`52508226(在线)`
|
||||
|
||||
@@ -170,6 +170,7 @@ fsql.Delete<Blog>()
|
||||
| DataType.Dameng(达梦) | server=127.0.0.1;port=5236;user id=2user;password=123456789;database=2user;poolsize=5 |
|
||||
| DataType.ShenTong(神通) | HOST=192.168.164.10;PORT=2003;DATABASE=OSRDB;USERNAME=SYSDBA;PASSWORD=szoscar55;MAXPOOLSIZE=2 |
|
||||
| DataType.KingbaseES(人大金仓) | Server=127.0.0.1;Port=54321;UID=USER2;PWD=123456789;database=TEST;MAXPOOLSIZE=2 |
|
||||
| DataType.Gbase(南大通用) | Driver={GBase ODBC DRIVER (64-Bit)};Host=192.168.164.134;Service=9088;Server=gbase01;Database=testdb;Protocol=onsoctcp;Uid=gbasedbt;Pwd=GBase123;Db_locale=zh_CN.utf8;Client_locale=zh_CN.utf8 |
|
||||
| DataType.OdbcMySql | Driver={MySQL ODBC 8.0 Unicode Driver}; Server=127.0.0.1;Persist Security Info=False; Trusted_Connection=Yes;UID=root;PWD=root; DATABASE=cccddd_odbc;Charset=utf8; SslMode=none;Min Pool Size=1 |
|
||||
| DataType.OdbcSqlServer | Driver={SQL Server};Server=.;Persist Security Info=False; Trusted_Connection=Yes;Integrated Security=True; DATABASE=freesqlTest_odbc; Pooling=true;Min Pool Size=1 |
|
||||
| DataType.OdbcOracle | Driver={Oracle in XE};Server=//127.0.0.1:1521/XE; Persist Security Info=False; Trusted_Connection=Yes;UID=odbc1;PWD=123456; Min Pool Size=1 |
|
||||
|
||||
2
多表查询.md
2
多表查询.md
@@ -157,7 +157,7 @@ fsql.Select<Topic>().ToList(a => new {
|
||||
//FROM `Topic` a
|
||||
```
|
||||
|
||||
> 提示:子查询 string.Join + ToList 适配了 sqlserver/pgsql/oracle/mysql/sqlite/firebird/达梦/金仓/翰高 [#405](https://github.com/dotnetcore/FreeSql/issues/405)
|
||||
> 提示:子查询 string.Join + ToList 适配了 sqlserver/pgsql/oracle/mysql/sqlite/firebird/达梦/金仓/南大/翰高 [#405](https://github.com/dotnetcore/FreeSql/issues/405)
|
||||
|
||||
## 8、子表First/Count/Sum/Max/Min/Avg
|
||||
```csharp
|
||||
|
||||
1
安装.md
1
安装.md
@@ -30,6 +30,7 @@ dotnet add package FreeSql.Provider.MySqlConnector
|
||||
| FreeSql.Provider.Dameng | NETStandard2.0、net45、net40 | 基于 达梦数据库 |**[](https://www.nuget.org/packages/FreeSql.Provider.Dameng)** |
|
||||
| FreeSql.Provider.ShenTong | NETStandard2.0、net45、net40 | 基于 神舟通用数据库 |**[](https://www.nuget.org/packages/FreeSql.Provider.ShenTong)** |
|
||||
| FreeSql.Provider.KingbaseES | NETStandard2.0、net461 | 基于 人大金仓数据库 |**[](https://www.nuget.org/packages/FreeSql.Provider.KingbaseES)** |
|
||||
| FreeSql.Provider.GBase | NETStandard2.0、net461 | 基于 南大通用GBase数据库 |**[](https://www.nuget.org/packages/FreeSql.Provider.GBase)** |
|
||||
| [FreeSql.Provider.Odbc](https://github.com/2881099/FreeSql/tree/master/Providers/FreeSql.Provider.Odbc) | NETStandard2.0、net45、net40 | 基于 ODBC |**[](https://www.nuget.org/packages/FreeSql.Provider.Odbc)** |
|
||||
| [FreeSql.Provider.Custom](https://github.com/2881099/FreeSql/tree/master/Providers/FreeSql.Provider.Custom) | NETStandard2.0、net45、net40 | 自定义数据库访问 |**[](https://www.nuget.org/packages/FreeSql.Provider.Custom)** |
|
||||
| FreeSql.Extensions.LazyLoading | NETStandard2.0、net45、net40 | 延时属性扩展包 |**[](https://www.nuget.org/packages/FreeSql.Extensions.LazyLoading )** |
|
||||
|
||||
4
实体特性.md
4
实体特性.md
@@ -68,9 +68,9 @@ class Topic {
|
||||
|
||||
当长度 -1 时产生的映射如下:
|
||||
|
||||
| MySql | PostgreSQL | SqlServer | Oracle | Sqlite | Firebird | MsAccess | 达梦 | 金仓 | 神通 |
|
||||
| MySql | PostgreSQL | SqlServer | Oracle | Sqlite | Firebird | MsAccess | 达梦 | 金仓 | 神通 | 南通 |
|
||||
| - | - | - | - | - | - | - | - | - | - |
|
||||
| text | text | nvarchar(max) | nclob | text | blob sub_type 1 | longtext | text | text | text |
|
||||
| text | text | nvarchar(max) | nclob | text | blob sub_type 1 | longtext | text | text | text | text |
|
||||
|
||||
> 注意:Oracle nclob 需要 v1.3.2+ 版本才支持,否则将映射 nvarchar2(4000)
|
||||
|
||||
|
||||
1
更新日志.md
1
更新日志.md
@@ -3,6 +3,7 @@
|
||||
|
||||
## 未发布
|
||||
|
||||
- 增加 南大通用 Gbase 国产数据库支持;
|
||||
- 优化 pgsql jsonb 映射,支持 List,mysql limit in 子查询;
|
||||
- 优化 InsertOrUpdate<> 使用 InsertOrUpdate<list<>>时,提示友好异常。
|
||||
- 修复 FreeSql.Generator 工具生成model失败 [#882](https://github.com/dotnetcore/FreeSql/issues/882)
|
||||
|
||||
@@ -114,7 +114,7 @@ fsql.Select<Area>()
|
||||
| (可选) pathSeparator | 设置 pathSelector 的连接符,默认:-> |
|
||||
| (可选) level | 设置递归层级 |
|
||||
|
||||
> 通过测试的数据库:MySql8.0、SqlServer、PostgreSQL、Oracle、Sqlite、Firebird、达梦、人大金仓、翰高
|
||||
> 通过测试的数据库:MySql8.0、SqlServer、PostgreSQL、Oracle、Sqlite、Firebird、达梦、人大金仓、南大通用、翰高
|
||||
|
||||
姿势一:AsTreeCte() + ToTreeList
|
||||
|
||||
|
||||
4
添加或修改.md
4
添加或修改.md
@@ -9,8 +9,8 @@ IFreeSql 定义了 InsertOrUpdate 方法实现添加或修改的功能,利用
|
||||
| MySql | on duplicate key update | | 达梦 | merge into |
|
||||
| PostgreSQL | on conflict do update | | 人大金仓 | on conflict do update |
|
||||
| SqlServer | merge into | | 神通 | merge into |
|
||||
| Oracle | merge into | | MsAccess | 不支持 |
|
||||
| Sqlite | replace into | | | |
|
||||
| Oracle | merge into | | 南大通用 | merge into |
|
||||
| Sqlite | replace into | | MsAccess | 不支持 |
|
||||
| Firebird | merge into | | | |
|
||||
|
||||
```csharp
|
||||
|
||||
4
类型映射.md
4
类型映射.md
@@ -76,9 +76,9 @@ public class S_SysConfig {
|
||||
|
||||
> string 指定长度 [Column(DbType = "varchar(max)")] 或者 [MaxLength(-1)] 或者 [Column(StringLength = -1)],当长度 -1 时产生的映射如下:
|
||||
|
||||
| MySql | PostgreSQL | SqlServer | Oracle | Sqlite | Firebird | MsAccess | 达梦 | 金仓 | 神通 |
|
||||
| MySql | PostgreSQL | SqlServer | Oracle | Sqlite | Firebird | MsAccess | 达梦 | 金仓 | 神通 | 南大 |
|
||||
| - | - | - | - | - | - | - | - | - | - |
|
||||
| text | text | nvarchar(max) | nclob | text | blob sub_type 1 | longtext | text | text | text |
|
||||
| text | text | nvarchar(max) | nclob | text | blob sub_type 1 | longtext | text | text | text | text |
|
||||
|
||||
> 注意:Oracle nclob 需要 v1.3.2+ 版本才支持,否则将映射 nvarchar2(4000)
|
||||
|
||||
|
||||
2
首页.md
2
首页.md
@@ -21,7 +21,7 @@ QQ群:4336577(已满)、8578575(在线)、52508226(在线)
|
||||
- ✒ 支持 丰富的表达式函数,以及灵活的自定义解析;
|
||||
- 🏁 支持 导航属性一对多、多对多贪婪加载,以及延时加载;
|
||||
- 📃 支持 读写分离、分表分库、过滤器、乐观锁、悲观锁;
|
||||
- 🌳 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/翰高/华为GaussDB/Access 等数据库;
|
||||
- 🌳 支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/神舟通用/南大通用/翰高/Access 等数据库;
|
||||
|
||||
## 学习指南
|
||||
|
||||
|
||||
Reference in New Issue
Block a user