且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Dapper QueryMultiple存储过程,不映射到对象

更新时间:2023-09-11 21:39:46

您想要什么API?如果可以单独处理网格,请执行以下操作:

What API do you want? If you can process the grids separately: do that:

using(var multi = connection.QueryMultiple(...))
{
    while(!multi.IsConsumed) {
        // ...
    }
}

其中 ... 可以访问:


  • Read()用于动态行-注意每一行也实现 IDictionary< string,object>

  • Read< T> ()通过泛型输入类型的行

  • Read(Type)用于没有泛型的类型化行

  • Read< DapperRow >()(实际上,这只是 Read< T>()$的 T c $ c>用于实现 Read(),但也许更方便),它提供了对元数据的更多访问

  • Read() for dynamic rows - noting that each row also implements IDictionary<string,object>
  • Read<T>() for typed rows via generics
  • Read(Type) for typed rows without generics
  • Read<DapperRow>() (actually, this is just the T that Read<T>() uses to implement Read(), but perhaps more convenient), which provides slightly more access to metadata

如果您想放到原始的 IDataReader ,请执行以下操作:

If you want to drop to a raw IDataReader, do that:

using(var reader = connection.ExecuteReader(...)) {
    // whatever you want
}

关于参数: DynamicParameters 类提供了更丰富的参数控制访问权限,包括参数方向等。

With regards to parameters: the DynamicParameters class provides much richer access to parameter control, including parameter-direction etc.