SqlSugar/README.md

20 lines
652 B
Markdown
Raw Normal View History

2017-05-23 07:40:55 +08:00
# SqlSugar 4.X
2017-05-23 07:35:31 +08:00
2017-05-23 07:41:22 +08:00
## 1. Query
2017-05-23 07:35:31 +08:00
2017-05-23 07:41:22 +08:00
### 1.1 Create Connection
2017-05-23 07:35:31 +08:00
```c
2017-05-23 07:40:07 +08:00
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig()
{ ConnectionString = Config.ConnectionString, DbType =DbType.SqlServer, IsAutoCloseConnection = true });
2017-05-23 07:35:31 +08:00
```
2017-05-23 07:41:22 +08:00
### 1.2 Introduction
2017-05-23 07:42:16 +08:00
```c
var getAll = db.Queryable<Student>().ToList();
var getAllNoLock = db.Queryable<Student>().With(SqlWith.NoLock).ToList();
var getByPrimaryKey = db.Queryable<Student>().InSingle(2);
var getByWhere = db.Queryable<Student>().Where(it => it.Id == 1 || it.Name == "a").ToList();
var getByFuns = db.Queryable<Student>().Where(it => NBORM.IsNullOrEmpty(it.Name)).ToList();
```
2017-05-23 07:35:31 +08:00