Update README.md

This commit is contained in:
sunkaixuan 2019-04-29 20:37:06 +08:00 committed by GitHub
parent ecf02e3e49
commit 945b24d28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ public class Student
## 1. SqlSugarClient.Queryable
## 1. Queryable
We use it to query
```cs
@ -110,7 +110,7 @@ JoinType.Left,st.SchoolId==sc.Id
## 2. SqlSugarClient.Updateable
## 2. Updateable
We use it to Update
```cs
//update reutrn Update Count
@ -148,7 +148,7 @@ var t10 = db.Updateable<Student>()
## 3. SqlSugarClient.Insertable
## 3. Insertable
We use it to Insert
```cs
var insertObj = new Student() { Name = "jack", CreateTime = Convert.ToDateTime("2010-1-1") ,SchoolId=1};
@ -182,7 +182,7 @@ var t9 = db.Insertable(insertObj2).Where(true/* Is insert null */, true/*off ide
//Insert List<T>
var s9 = db.Insertable(insertObjs).InsertColumns(it => new { it.Name }).ExecuteCommand();
```
## 4. SqlSugarClient.Deleteable
## 4. Deleteable
We use it to Delete
```cs
@ -203,14 +203,14 @@ var t5 = db.Deleteable<Student>().Where(it => it.Id == 1).ExecuteCommand();
```
## 5. SqlSugarClient.SqlQueryable
## 5. SqlQueryable
```cs
var list = db.SqlQueryable<Student>("select * from student").ToPageList(1, 2);
var list2 = db.SqlQueryable<Student>("select * from student").Where(it=>it.Id==1).ToPageList(1, 2);
var list3= db.SqlQueryable<Student>("select * from student").Where("id=@id",new { id=1}).ToPageList(1, 2);
```
## 6. SqlSugarClient.SaveQueues
## 6. SaveQueues
Perform multiple operations together with transactions
```cs
var db = GetInstance();
@ -230,7 +230,7 @@ db.AddQueue("select * from student where id=@id", new { id = 1 });
var result2 = db.SaveQueues<Student, School, Student>();
```
## 7.SqlSugarClient.Ado
## 7.Ado
db.Ado.MethodNameLook at the following example
```cs
var dt=db.Ado.GetDataTable("select * from table where id=@id and name=@name",new List<SugarParameter>(){
@ -246,7 +246,7 @@ var ageP= new SugarParameter("@age", null, true);//isOutput=true
var dt2 = db.Ado.UseStoredProcedure().GetDataTable("sp_school",nameP,ageP);
```
## 8.SqlSugarClient.Saveable
## 8.Saveable
Insert or Update
```cs
db.Saveable<Student>(entity).ExecuteReturnEntity();
@ -257,7 +257,7 @@ db.Saveable<Student>(new Student() { Name = "" })
```
## 9.SqlSugarClient.EntityMain
## 9.EntityMain
```cs
var entityInfo=db.EntityMaintenance.GetEntityInfo<Student>();
foreach (var column in entityInfo.Columns)
@ -265,7 +265,7 @@ foreach (var column in entityInfo.Columns)
Console.WriteLine(column.ColumnDescription);
}
```
## 10.SqlSugarClient.DbMain
## 10.DbMain
```cs
var tables = db.DbMaintenance.GetTableInfoList();
foreach (var table in tables)
@ -275,7 +275,7 @@ foreach (var column in entityInfo.Columns)
```
## 11.SqlSugarClient.Aop
## 11.Aop
```cs
db.Aop.OnLogExecuted = (sql, pars) => //SQL executed event
{
@ -296,7 +296,7 @@ db.Aop.OnExecutingChangeSql = (sql, pars) => //SQL executing event (pre-exe
```
## 12.SqlSugarClient.QueryFilter
## 12.QueryFilter
```cs
//gobal filter
@ -318,7 +318,7 @@ public static SqlSugarClient GetInstance()
return db;
}
```
## 13.SqlSugarClient.DbFirst
## 13.DbFirst
```cs
var db = GetInstance();
//Create all class
@ -347,17 +347,17 @@ db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\Demo\\5");
```
## 14.SqlSugarClient.CodeFirst
## 14.CodeFirst
```cs
db.CodeFirst.SetStringDefaultLength(100).BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2)); //change entity backupTable
db.CodeFirst.SetStringDefaultLength(100).InitTables(typeof(CodeTable), typeof(CodeTable2));
```
## 15.SqlSugarClient.Utilities
## 15.Utilities
```cs
var list = db.Utilities.DataTableToList(datatable);
```
## 16.SqlSugarClient.SimpleClient
## 16.SimpleClient
```cs
var db = GetInstance();
var sdb = db.GetSimpleClient<Student>();