Update README.md

This commit is contained in:
果糖网 2021-10-10 23:25:48 +08:00 committed by GitHub
parent c227b6de0d
commit f75ce1d544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,14 +136,14 @@ public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
tran.CommitTran();//这个提交不能漏掉 tran.CommitTran();//这个提交不能漏掉
} }
``` ```
### Feature6 : Query Filter ### Feature6 : Query filter
```cs ```cs
//set Filter //set Filter
db.QueryFilter.Add(new TableFilterItem<Order>(it => it.Name.Contains("a"))); //为Order表置全局条件 db.QueryFilter.Add(new TableFilterItem<Order>(it => it.Name.Contains("a")));
db.Queryable<Order>().ToList(); db.Queryable<Order>().ToList();
//SELECT [Id],[Name],[Price],[CreateTime],[CustomId] FROM [Order] WHERE ([Name] like '%'+@MethodConst0+'%') //SELECT [Id],[Name],[Price],[CreateTime],[CustomId] FROM [Order] WHERE ([Name] like '%'+@MethodConst0+'%')
db.Queryable<OrderItem, Order>((i, o) => i.OrderId == o.Id) db.Queryable<OrderItem, Order>((i, o) => i.OrderId == o.Id)
.Where(i => i.OrderId != 0) .Where(i => i.OrderId != 0)