Merge branch 'master' of https://github.com/2881099/FreeSql.wiki

28810
2020-09-24 12:41:39 +08:00
2 changed files with 17 additions and 11 deletions

@@ -12,7 +12,7 @@ QQ群4336577(已满)、8578575(在线)、52508226(在线)
- [x] 支持导航属性查询,和延时加载;
- [x] 支持同步/异步数据库操作方法,丰富多彩的链式查询方法;
- [x] 支持读写分离、分表分库,租户设计;
- [x] 支持多种数据库MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/神通/人大仓/MsAccess
- [x] 支持多种数据库MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/神通/人大仓/MsAccess
## 学习指南

@@ -115,7 +115,7 @@ public class Song {
public string Title { get; set; }
}
//在控制器使用
public SongsController(GuidRepository<Song> repo1, GuidRepository<xxxx> repos2) {
public SongsController(IBaseRepository<Song> repo1, IBaseRepository<xxxx> repos2) {
//在此打断点,调试
}
```
@@ -123,24 +123,30 @@ public SongsController(GuidRepository<Song> repo1, GuidRepository<xxxx> repos2)
第一次请求:
repo1.Select.ToSql()
> "SELECT a."Id", a."Title" \r\nFROM "Song" a \r\nWHERE (a."Title" = strftime('%Y-%m-%d %H:%M.%f',datetime(current_timestamp,'localtime')) || 21)"
```
"SELECT a."Id", a."Title" FROM "Song" a WHERE (a."Title" = strftime('%Y-%m-%d %H:%M.%f',datetime(current_timestamp,'localtime')) || 21)"
```
repos2.Select.ToSql()
>"SELECT a."Id" \r\nFROM "xxxx" a"
```
"SELECT a."Id" FROM "xxxx" a"
```
第二次请求:
repo1.Select.ToSql()
>"SELECT a."Id", a."Title" \r\nFROM "Song" a \r\nWHERE (a."Title" = strftime('%Y-%m-%d %H:%M.%f',datetime(current_timestamp,'localtime')) || 4)"
```
"SELECT a."Id", a."Title" FROM "Song" a WHERE (a."Title" = strftime('%Y-%m-%d %H:%M.%f',datetime(current_timestamp,'localtime')) || 4)"
```
repos2.Select.ToSql()
>"SELECT a."Id" \r\nFROM "xxxx" a"
```
"SELECT a."Id" FROM "xxxx" a"
```
//禁用过滤器
repo1.DataFilter.Disable("test")
repo1.Select.ToSql()
> "SELECT a."Id", a."Title" \r\nFROM "Song" a"
```
"SELECT a."Id", a."Title" FROM "Song" a"
```
1、注入的变量值在使用时有了动态变化每次获取时都是新的Thread.CurrentThread.ManagedThreadId