Skip to main content

SqlMapper.GridReader

The grid reader provides interfaces for reading multiple result sets from a Dapper query

Assembly: ServiceStack.OrmLite.dll​
View Source​
Declaration
public class GridReader : IDisposable

Properties​

IsConsumed​

Has the underlying reader been consumed?

View Source​
Declaration
public bool IsConsumed { get; }

Command​

The command associated with the reader

View Source​
Declaration
public IDbCommand Command { get; set; }

Methods​

ReadAsync(Boolean)​

Read the next grid of results, returned as a dynamic object

Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public Task<IEnumerable<dynamic>> ReadAsync(bool buffered = true)
Returns​

Task<IEnumerable<System.Object>>

Parameters​
TypeNameDescription
System.BooleanbufferedWhether to buffer the results.

Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> |

ReadFirstAsync()​

Read an individual row of the next grid of results, returned as a dynamic object

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public Task<dynamic> ReadFirstAsync()
Returns​

Task<System.Object>

ReadFirstOrDefaultAsync()​

Read an individual row of the next grid of results, returned as a dynamic object

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public Task<dynamic> ReadFirstOrDefaultAsync()
Returns​

Task<System.Object>

ReadSingleAsync()​

Read an individual row of the next grid of results, returned as a dynamic object

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public Task<dynamic> ReadSingleAsync()
Returns​

Task<System.Object>

ReadSingleOrDefaultAsync()​

Read an individual row of the next grid of results, returned as a dynamic object

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public Task<dynamic> ReadSingleOrDefaultAsync()
Returns​

Task<System.Object>

ReadAsync(Type, Boolean)​

Read the next grid of results

View Source​
Declaration
public Task<IEnumerable<object>> ReadAsync(Type type, bool buffered = true)
Returns​

Task<IEnumerable<System.Object>>

Parameters​
TypeNameDescription
TypetypeThe type to read.

| | System.Boolean | buffered | Whether to buffer the results.

|

ReadFirstAsync(Type)​

Read an individual row of the next grid of results

View Source​
Declaration
public Task<object> ReadFirstAsync(Type type)
Returns​

Task<System.Object>

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadFirstOrDefaultAsync(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<object> ReadFirstOrDefaultAsync(Type type)
Returns​

Task<System.Object>

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadSingleAsync(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<object> ReadSingleAsync(Type type)
Returns​

Task<System.Object>

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadSingleOrDefaultAsync(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<object> ReadSingleOrDefaultAsync(Type type)
Returns​

Task<System.Object>

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadAsync<T>(Boolean)​

Read the next grid of results.

View Source​
Declaration
public Task<IEnumerable<T>> ReadAsync<T>(bool buffered = true)
Returns​

Task<IEnumerable<<T>>>

Parameters​
TypeNameDescription
System.BooleanbufferedWhether the results should be buffered in memory.

|

Type Parameters​
NameDescription
TThe type to read.

ReadFirstAsync<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<T> ReadFirstAsync<T>()
Returns​

Task<<T>>

Type Parameters​
NameDescription
TThe type to read.

ReadFirstOrDefaultAsync<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<T> ReadFirstOrDefaultAsync<T>()
Returns​

Task<<T>>

Type Parameters​
NameDescription
TThe type to read.

ReadSingleAsync<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<T> ReadSingleAsync<T>()
Returns​

Task<<T>>

Type Parameters​
NameDescription
TThe type to read.

ReadSingleOrDefaultAsync<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public Task<T> ReadSingleOrDefaultAsync<T>()
Returns​

Task<<T>>

Type Parameters​
NameDescription
TThe type to read.

Read(Boolean)​

Read the next grid of results, returned as a dynamic object.

Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public IEnumerable<dynamic> Read(bool buffered = true)
Returns​

IEnumerable<System.Object>

Parameters​
TypeNameDescription
System.BooleanbufferedWhether the results should be buffered in memory.

Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object> |

ReadFirst()​

Read an individual row of the next grid of results, returned as a dynamic object.

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public dynamic ReadFirst()
Returns​

System.Object

ReadFirstOrDefault()​

Read an individual row of the next grid of results, returned as a dynamic object.

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public dynamic ReadFirstOrDefault()
Returns​

System.Object

ReadSingle()​

Read an individual row of the next grid of results, returned as a dynamic object.

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public dynamic ReadSingle()
Returns​

System.Object

ReadSingleOrDefault()​

Read an individual row of the next grid of results, returned as a dynamic object.

Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>

View Source​
Declaration
public dynamic ReadSingleOrDefault()
Returns​

System.Object

Read<T>(Boolean)​

Read the next grid of results.

View Source​
Declaration
public IEnumerable<T> Read<T>(bool buffered = true)
Returns​

IEnumerable<<T>>

Parameters​
TypeNameDescription
System.BooleanbufferedWhether the results should be buffered in memory.

|

Type Parameters​
NameDescription
TThe type to read.

ReadFirst<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public T ReadFirst<T>()
Returns​

<T>

Type Parameters​
NameDescription
TThe type to read.

ReadFirstOrDefault<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public T ReadFirstOrDefault<T>()
Returns​

<T>

Type Parameters​
NameDescription
TThe type to read.

ReadSingle<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public T ReadSingle<T>()
Returns​

<T>

Type Parameters​
NameDescription
TThe type to read.

ReadSingleOrDefault<T>()​

Read an individual row of the next grid of results.

View Source​
Declaration
public T ReadSingleOrDefault<T>()
Returns​

<T>

Type Parameters​
NameDescription
TThe type to read.

Read(Type, Boolean)​

Read the next grid of results.

View Source​
Declaration
public IEnumerable<object> Read(Type type, bool buffered = true)
Returns​

IEnumerable<System.Object>

Parameters​
TypeNameDescription
TypetypeThe type to read.

| | System.Boolean | buffered | Whether to buffer the results.

|

ReadFirst(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public object ReadFirst(Type type)
Returns​

System.Object

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadFirstOrDefault(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public object ReadFirstOrDefault(Type type)
Returns​

System.Object

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadSingle(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public object ReadSingle(Type type)
Returns​

System.Object

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

ReadSingleOrDefault(Type)​

Read an individual row of the next grid of results.

View Source​
Declaration
public object ReadSingleOrDefault(Type type)
Returns​

System.Object

Parameters​
TypeNameDescription
TypetypeThe type to read.

|

Read<TFirst, TSecond, TReturn>(Func<TFirst, TSecond, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid.

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TReturn>(Func<TFirst, TSecond, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TReturnThe type to return from the record set.

Read<TFirst, TSecond, TThird, TReturn>(Func<TFirst, TSecond, TThird, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid.

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TThird, TReturn>(Func<TFirst, TSecond, TThird, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TThird>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TThirdThe third type in the record set.
TReturnThe type to return from the record set.

Read<TFirst, TSecond, TThird, TFourth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TThird, TFourth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TThird>,<TFourth>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TThirdThe third type in the record set.
TFourthThe fourth type in the record set.
TReturnThe type to return from the record set.

Read<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TThird>,<TFourth>,<TFifth>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TThirdThe third type in the record set.
TFourthThe fourth type in the record set.
TFifthThe fifth type in the record set.
TReturnThe type to return from the record set.

Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TThird>,<TFourth>,<TFifth>,<TSixth>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TThirdThe third type in the record set.
TFourthThe fourth type in the record set.
TFifthThe fifth type in the record set.
TSixthThe sixth type in the record set.
TReturnThe type to return from the record set.

Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid

View Source​
Declaration
public IEnumerable<TReturn> Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn> func, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Func<<TFirst>,<TSecond>,<TThird>,<TFourth>,<TFifth>,<TSixth>,<TSeventh>,<TReturn>>funcThe mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TFirstThe first type in the record set.
TSecondThe second type in the record set.
TThirdThe third type in the record set.
TFourthThe fourth type in the record set.
TFifthThe fifth type in the record set.
TSixthThe sixth type in the record set.
TSeventhThe seventh type in the record set.
TReturnThe type to return from the record set.

Read<TReturn>(Type[], Func<Object[], TReturn>, String, Boolean)​

Read multiple objects from a single record set on the grid

View Source​
Declaration
public IEnumerable<TReturn> Read<TReturn>(Type[] types, Func<object[], TReturn> map, string splitOn = "id", bool buffered = true)
Returns​

IEnumerable<<TReturn>>

Parameters​
TypeNameDescription
Type[]typesThe types to read from the result set.

| | Func<System.Object[],<TReturn>> | map | The mapping function from the read types to the return type.

| | System.String | splitOn | The field(s) we should split and read the second object from (defaults to "id")

| | System.Boolean | buffered | Whether to buffer results in memory.

|

Type Parameters​
NameDescription
TReturnThe type to return from the record set.

Dispose()​

Dispose the grid, closing and disposing both the underlying reader and command.

View Source​
Declaration
public void Dispose()