Browse Source

Merge branch 'dev' of github.com:sunkaixuan/SqlSugar

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
21a39fae6d
  1. 39
      README.md

39
README.md

@ -125,7 +125,7 @@ var t4 = db.Updateable(updateObj).IgnoreColumns(it => new { it.Name, it.TestId }
var t7 = db.Updateable(updateObjs).ExecuteCommand(); var t7 = db.Updateable(updateObjs).ExecuteCommand();
//Where By Expression //Where By Expression
var t9 = db.Updateable(updateObj).Where(it => it.Id == 1).ExecuteCommand(); var t9 = db.Updateable(it=>new class() { name="a",createtime=p }).Where(it => it.Id == 1).ExecuteCommand();
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/2.Updateable) [<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/2.Updateable)
@ -155,21 +155,20 @@ var s9 = db.Insertable(insertObjs).InsertColumns(it => new { it.Name }).ExecuteC
We use it to Delete We use it to Delete
```cs ```cs
var t1 = db.Deleteable<Student>().Where(new Student() { Id = 1 }).ExecuteCommand(); //by entity
db.Deleteable<Student>().Where(new Student() { Id = 1 }).ExecuteCommand();
//use lock
var t2 = db.Deleteable<Student>().With(SqlWith.RowLock).ExecuteCommand();
//by primary key //by primary key
var t3 = db.Deleteable<Student>().In(1).ExecuteCommand(); db.Deleteable<Student>().In(1).ExecuteCommand();
//by primary key array //by primary key array
var t4 = db.Deleteable<Student>().In(new int[] { 1, 2 }).ExecuteCommand(); db.Deleteable<Student>().In(new int[] { 1, 2 }).ExecuteCommand();
//by expression //by expression
var t5 = db.Deleteable<Student>().Where(it => it.Id == 1).ExecuteCommand(); db.Deleteable<Student>().Where(it => it.Id == 1).ExecuteCommand();
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/4.Deleteable )
## 5. SqlQueryable ## 5. SqlQueryable
@ -178,6 +177,7 @@ 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 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); var list3= db.SqlQueryable<Student>("select * from student").Where("id=@id",new { id=1}).ToPageList(1, 2);
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/5.SqlQueryable )
## 6. SaveQueues ## 6. SaveQueues
Perform multiple operations together with transactions Perform multiple operations together with transactions
@ -198,6 +198,8 @@ db.Queryable<School>().AddQueue();
db.AddQueue("select * from student where id=@id", new { id = 1 }); db.AddQueue("select * from student where id=@id", new { id = 1 });
var result2 = db.SaveQueues<Student, School, Student>(); var result2 = db.SaveQueues<Student, School, Student>();
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/6.queue )
## 7.Ado ## 7.Ado
db.Ado.MethodName,Look at the following example db.Ado.MethodName,Look at the following example
@ -214,6 +216,7 @@ var nameP= new SugarParameter("@name", "张三");
var ageP= new SugarParameter("@age", null, true);//isOutput=true var ageP= new SugarParameter("@age", null, true);//isOutput=true
var dt2 = db.Ado.UseStoredProcedure().GetDataTable("sp_school",nameP,ageP); var dt2 = db.Ado.UseStoredProcedure().GetDataTable("sp_school",nameP,ageP);
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/7.ado )
## 8.Saveable ## 8.Saveable
Insert or Update Insert or Update
@ -225,6 +228,7 @@ db.Saveable<Student>(new Student() { Name = "" })
.ExecuteReturnEntity(); .ExecuteReturnEntity();
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/8.saveable )
## 9.EntityMain ## 9.EntityMain
```cs ```cs
@ -234,6 +238,8 @@ foreach (var column in entityInfo.Columns)
Console.WriteLine(column.ColumnDescription); Console.WriteLine(column.ColumnDescription);
} }
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/9.entityMain )
## 10.DbMain ## 10.DbMain
```cs ```cs
var tables = db.DbMaintenance.GetTableInfoList(); var tables = db.DbMaintenance.GetTableInfoList();
@ -242,6 +248,7 @@ foreach (var column in entityInfo.Columns)
Console.WriteLine(table.Description); Console.WriteLine(table.Description);
} }
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/a.DbMain )
## 11.Aop ## 11.Aop
@ -264,6 +271,7 @@ db.Aop.OnExecutingChangeSql = (sql, pars) => //SQL executing event (pre-exe
}; };
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/b.aop )
## 12.QueryFilter ## 12.QueryFilter
```cs ```cs
@ -287,6 +295,8 @@ public static SqlSugarClient GetInstance()
return db; return db;
} }
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/c.GobalFilter )
## 13.DbFirst ## 13.DbFirst
```cs ```cs
var db = GetInstance(); var db = GetInstance();
@ -316,16 +326,24 @@ db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\Demo\\5");
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/d.DbFirst )
## 14.CodeFirst ## 14.CodeFirst
```cs ```cs
db.CodeFirst.SetStringDefaultLength(100).BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2)); //change entity backupTable db.CodeFirst.SetStringDefaultLength(100).BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2)); //change entity backupTable
db.CodeFirst.SetStringDefaultLength(100).InitTables(typeof(CodeTable), typeof(CodeTable2)); db.CodeFirst.SetStringDefaultLength(100).InitTables(typeof(CodeTable), typeof(CodeTable2));
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/e.CodeFirst )
## 15.Utilities ## 15.Utilities
```cs ```cs
var list = db.Utilities.DataTableToList(datatable); var list = db.Utilities.DataTableToList(datatable);
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities )
## 16.SimpleClient ## 16.SimpleClient
```cs ```cs
var db = GetInstance(); var db = GetInstance();
@ -337,6 +355,9 @@ sdb.Update(obj);
``` ```
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/g.SimpleClient )
# Code generator # Code generator
https://github.com/sunkaixuan/SoEasyPlatform https://github.com/sunkaixuan/SoEasyPlatform

Loading…
Cancel
Save