mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 12:33:44 +08:00
Update README.md
This commit is contained in:
17
README.md
17
README.md
@@ -135,38 +135,23 @@ var t9 = db.Updateable(updateObj).Where(it => it.Id == 1).ExecuteCommand();
|
|||||||
## 3. Insertable
|
## 3. Insertable
|
||||||
We use it to Insert
|
We use it to Insert
|
||||||
```cs
|
```cs
|
||||||
var insertObj = new Student() { Name = "jack", CreateTime = Convert.ToDateTime("2010-1-1") ,SchoolId=1};
|
|
||||||
|
|
||||||
//Insert reutrn Insert Count
|
//Insert reutrn Insert Count
|
||||||
var t2 = db.Insertable(insertObj).ExecuteCommand();
|
var t2 = db.Insertable(insertObj).ExecuteCommand();
|
||||||
|
|
||||||
//Insert reutrn Identity Value
|
//Insert reutrn Identity Value
|
||||||
var t3 = db.Insertable(insertObj).ExecuteReutrnIdentity();
|
var t3 = db.Insertable(insertObj).ExecuteReutrnIdentity();
|
||||||
|
|
||||||
|
|
||||||
//Only insert Name
|
//Only insert Name
|
||||||
var t4 = db.Insertable(insertObj).InsertColumns(it => new { it.Name,it.SchoolId }).ExecuteReutrnIdentity();
|
var t4 = db.Insertable(insertObj).InsertColumns(it => new { it.Name,it.SchoolId }).ExecuteReutrnIdentity();
|
||||||
|
|
||||||
|
|
||||||
//Ignore TestId
|
//Ignore TestId
|
||||||
var t5 = db.Insertable(insertObj).IgnoreColumns(it => new { it.Name, it.TestId }).ExecuteReutrnIdentity();
|
var t5 = db.Insertable(insertObj).IgnoreColumns(it => new { it.Name, it.TestId }).ExecuteReutrnIdentity();
|
||||||
|
|
||||||
|
|
||||||
//Ignore TestId
|
|
||||||
var t6 = db.Insertable(insertObj).IgnoreColumns(it => it == "Name" || it == "TestId").ExecuteReutrnIdentity();
|
|
||||||
|
|
||||||
|
|
||||||
//Use Lock
|
|
||||||
var t8 = db.Insertable(insertObj).With(SqlWith.UpdLock).ExecuteCommand();
|
|
||||||
|
|
||||||
|
|
||||||
var insertObj2 = new Student() { Name = null, CreateTime = Convert.ToDateTime("2010-1-1") };
|
|
||||||
var t9 = db.Insertable(insertObj2).Where(true/* Is insert null */, true/*off identity*/).ExecuteCommand();
|
|
||||||
|
|
||||||
//Insert List<T>
|
//Insert List<T>
|
||||||
var s9 = db.Insertable(insertObjs).InsertColumns(it => new { it.Name }).ExecuteCommand();
|
var s9 = db.Insertable(insertObjs).InsertColumns(it => new { it.Name }).ExecuteCommand();
|
||||||
```
|
```
|
||||||
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/3.Insertable)
|
[<font color=red>View more >> </font>](https://github.com/sunkaixuan/SqlSugar/wiki/3.Insertable)
|
||||||
|
|
||||||
## 4. Deleteable
|
## 4. Deleteable
|
||||||
We use it to Delete
|
We use it to Delete
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user