update

2881099
2022-11-07 11:59:29 +08:00
parent 7522d7421c
commit e99644e40f

@@ -18,6 +18,59 @@ FreeSql has made great efforts in querying data, especially the functions such a
- [《Sharding Tables and Database》](Sharding-Tables-and-Database)
- [《Tenant》](Tenant)
## SqlServer WithLock、WithIndex
```csharp
var list = fsql.Select<Region>()
.WithLock()
.Limit(1).ToList();
//SELECT TOP 1 ... FROM [Region] a With(NoLock)
var list = fsql.Select<Region>()
.WithLock(SqlServerLock.NoLock | SqlServerLock.NoWait)
.Limit(1).ToList();
//SELECT TOP 1 ... FROM [Region] a With(NoLock, NoWait)
var list = fsql.Select<Region>()
.WithLock()
.WithIndex("idx_01")
.Limit(1).ToList();
//SELECT TOP 1 ... FROM [Region] a With(index=idx_01, NoLock)
```
Multi-Tables Query:
```csharp
var list = Select<Region, T2>()
.InnerJoin((a, b) => a.x == b.xx)
.WithLock(SqlServerLock.NoLock, new Dictionary<Type, bool>
{
[typeof(T2)] = false
})
.WithIndex("idx_01", new Dictionary<Type, string>
{
[typeof(T2)] = "idx_02"
})
.Limit(1).ToList();
//SELECT TOP 1 ..
//FROM [Region] a With(index=idx_01, NoLock)
//INNER JOIN [T2] b With(index=idx_02) ON a.[x] = b.[xx]
``````
Global NoLock:
```csharp
//All entities
fsql.SetGlobalSelectWithLock(SqlServerLock.NoLock, null);
//Effective designation
fsql.SetGlobalSelectWithLock(SqlServerLock.NoLock, new Dictionary<Type, bool>
{
[typeof(Region)] = true,
[typeof(T2)] = true
});
```
## Special introduction to WhereDynamicFilter
[《高效理解 FreeSql WhereDynamicFilter深入了解设计初衷》](https://www.cnblogs.com/FreeSql/p/16485310.html)