mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-04 15:30:53 +08:00
update
10
Ado.md
10
Ado.md
@@ -1,4 +1,4 @@
|
||||
Ado 是 IFreeSql 下重要的对象之一,它包括所有对 SQL 操作的封装,类似 SqlHelper。
|
||||
Ado 是 IFreeSql 下重要的对象之一,它包括所有对 SQL 操作的封装,提供 ExecuteReader、ExecuteDataSet、ExecuteDataTable、ExecuteNonQuery、ExecuteScalar 等方法,使用起来和传统 SqlHelper 一样。
|
||||
|
||||
## 查询 SQL 返回实体
|
||||
|
||||
@@ -15,6 +15,8 @@ List<T1> list1 = result.Item1;
|
||||
List<T2> list2 = result.Item2;
|
||||
```
|
||||
|
||||
## 参数化
|
||||
|
||||
Ado 下面所有参数 object parms 都可以接受匿名对象,或者字典:
|
||||
|
||||
- new { id = 1, name = "xx" }
|
||||
@@ -26,10 +28,6 @@ Ado 下面所有参数 object parms 都可以接受匿名对象,或者字典
|
||||
bool isok = fsql.Ado.ExecuteConnectTest();
|
||||
```
|
||||
|
||||
## SqlHelper
|
||||
|
||||
fsql.Ado 还提供了 ExecuteReader、ExecuteDataSet、ExecuteDataTable、ExecuteNonQuery、ExecuteScalar 方法,使用起来等传统 SqlHelper 几乎一样。
|
||||
|
||||
## CommandFluent
|
||||
|
||||
fsql.Ado 重载方法太多的情况下,建议使用 CommandFluent,例如存储过程:
|
||||
@@ -47,7 +45,7 @@ fsql.Ado.CommandFluent("dbo.GetICMaxNum")
|
||||
p.DbType = DbType.Int32;
|
||||
p.Direction = ParameterDirection.Output;
|
||||
})
|
||||
.ExecuteNonQuery(); //提供 SqlHelper 的各种方式执行
|
||||
.ExecuteNonQuery(); //.Query<T>() 或者 .ExecuteDataTable() 或者 ...
|
||||
|
||||
Console.WriteLine(p2.Value);
|
||||
```
|
||||
Reference in New Issue
Block a user