Skip to content

Commit 546d912

Browse files
authored
Merge pull request #4 from dotarj/feature-gridreader-extensions#2
GridReader extension methods added
2 parents ab0fc99 + ac3c26b commit 546d912

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Collections.Generic;
2+
3+
namespace Dapper.Mapper
4+
{
5+
public static class GridReaderExtensions
6+
{
7+
public static IEnumerable<TFirst> Read<TFirst, TSecond>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
8+
{
9+
return gridReader.Read(MappingCache<TFirst, TSecond>.Map, splitOn, buffered);
10+
}
11+
12+
public static IEnumerable<TFirst> Read<TFirst, TSecond, TThird>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
13+
{
14+
return gridReader.Read(MappingCache<TFirst, TSecond, TThird>.Map, splitOn, buffered);
15+
}
16+
17+
public static IEnumerable<TFirst> Read<TFirst, TSecond, TThird, TFourth>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
18+
{
19+
return gridReader.Read(MappingCache<TFirst, TSecond, TThird, TFourth>.Map, splitOn, buffered);
20+
}
21+
22+
public static IEnumerable<TFirst> Read<TFirst, TSecond, TThird, TFourth, TFifth>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
23+
{
24+
return gridReader.Read(MappingCache<TFirst, TSecond, TThird, TFourth, TFifth>.Map, splitOn, buffered);
25+
}
26+
27+
public static IEnumerable<TFirst> Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
28+
{
29+
return gridReader.Read(MappingCache<TFirst, TSecond, TThird, TFourth, TFifth, TSixth>.Map, splitOn, buffered);
30+
}
31+
32+
public static IEnumerable<TFirst> Read<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh>(this Dapper.SqlMapper.GridReader gridReader, string splitOn = "id", bool buffered = true)
33+
{
34+
return gridReader.Read(MappingCache<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh>.Map, splitOn, buffered);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)