Update README.md

This commit is contained in:
果糖网 2022-04-15 15:06:16 +08:00 committed by GitHub
parent d40ad6d309
commit d7e1e7e780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,11 +43,6 @@ var query = db.Queryable<Order>()
.Where(o => o.Id == 1) .Where(o => o.Id == 1)
.Select((o, cus) => new ViewOrder { Id = o.Id, CustomName = cus.Name }) .Select((o, cus) => new ViewOrder { Id = o.Id, CustomName = cus.Name })
.ToList(); .ToList();
var list=db.Queryable<Test>()
.Includes(x => x.Provinces,x=>x.Citys ,x=>x.Street)
.Includes(x => x.ClassInfo)
.ToList();
``` ```
```sql ```sql
SELECT SELECT
@ -61,8 +56,15 @@ FROM
WHERE WHERE
([o].[Id] = @Id0) ([o].[Id] = @Id0)
``` ```
### Feature2 : Page query ### Feature2 : Page query
```cs Include Query
var list=db.Queryable<Test>()
.Includes(x => x.Provinces,x=>x.Citys ,x=>x.Street)
.Includes(x => x.ClassInfo)
.ToList();
```
### Feature3 : Page query
```cs ```cs
int pageIndex = 1; int pageIndex = 1;
@ -71,7 +73,7 @@ WHERE
var page = db.Queryable<Student>().ToPageList(pageIndex, pageSize, ref totalCount); var page = db.Queryable<Student>().ToPageList(pageIndex, pageSize, ref totalCount);
``` ```
### Feature3 : Dynamic expression ### Feature4 : Dynamic expression
```cs ```cs
var names= new string [] { "a","b"}; var names= new string [] { "a","b"};
Expressionable<Order> exp = new Expressionable<Order>(); Expressionable<Order> exp = new Expressionable<Order>();
@ -88,7 +90,7 @@ SELECT [Id],[Name],[Price],[CreateTime],[CustomId]
([Name] like '%'+ CAST(@MethodConst1 AS NVARCHAR(MAX))+'%') ([Name] like '%'+ CAST(@MethodConst1 AS NVARCHAR(MAX))+'%')
) )
``` ```
### Feature4 : Multi-tenant transaction ### Feature5 : Multi-tenant transaction
```cs ```cs
//Creaate database object //Creaate database object
SqlSugarClient db = new SqlSugarClient(new List<ConnectionConfig>() SqlSugarClient db = new SqlSugarClient(new List<ConnectionConfig>()
@ -114,7 +116,7 @@ db.BeginTran();
db.CommitTran(); db.CommitTran();
``` ```
### Feature5 : Singleton Pattern ### Feature6 : Singleton Pattern
Implement transactions across methods Implement transactions across methods
```CS ```CS
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig() public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
@ -143,7 +145,7 @@ public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
tran.CommitTran(); tran.CommitTran();
} }
``` ```
### Feature6 : Query filter ### Feature7 : Query filter
```cs ```cs
//set filter //set filter
db.QueryFilter.Add(new TableFilterItem<Order>(it => it.Name.Contains("a"))); db.QueryFilter.Add(new TableFilterItem<Order>(it => it.Name.Contains("a")));
@ -160,7 +162,7 @@ db.Queryable<OrderItem, Order>((i, o) => i.OrderId == o.Id)
``` ```
### Feature7 : Insert or update ### Feature8 : Insert or update
insert or update insert or update
```cs ```cs
var x = Db.Storageable(list2).ToStorage(); var x = Db.Storageable(list2).ToStorage();
@ -173,7 +175,7 @@ var x = Db.Storageable(list).SplitInsert(it => !it.Any()).ToStorage()
x.AsInsertable.ExecuteCommand(); x.AsInsertable.ExecuteCommand();
``` ```
### Feature8 Auto split table ### Feature9 Auto split table
Split entity Split entity
```cs ```cs
[SplitTable(SplitType.Year)]//Table by year (the table supports year, quarter, month, week and day) [SplitTable(SplitType.Year)]//Table by year (the table supports year, quarter, month, week and day)
@ -199,7 +201,7 @@ Split query
.ToPageList(1,2);  .ToPageList(1,2); 
``` ```
### Feature9 Big data insert or update ### Feature10 Big data insert or update
```cs ```cs
//Insert A million only takes a few seconds //Insert A million only takes a few seconds
db.Fastest<RealmAuctionDatum>().BulkCopy(GetList()); db.Fastest<RealmAuctionDatum>().BulkCopy(GetList());