@@ -17,13 +17,14 @@ public abstract class DapperResult<T> : GriddlyResult<T>
17
17
Func < IDbConnection , IDbTransaction , string , object , IEnumerable < T > > _map ;
18
18
Action < IDbConnection , IDbTransaction , IList < T > > _massage ;
19
19
long ? _overallCount = null ;
20
+ int ? _commandTimeout = null ;
20
21
21
22
protected string _outerSqlTemplate ;
22
23
protected string _sql ;
23
24
protected bool _fixedSort ;
24
25
protected static readonly bool _hasOverallCount = typeof ( IHasOverallCount ) . IsAssignableFrom ( typeof ( T ) ) ;
25
26
26
- public DapperResult ( Func < IDbConnection > getConnection , string sql , object param , Func < IDbConnection , IDbTransaction , string , object , IEnumerable < T > > map , Action < IDbConnection , IDbTransaction , IList < T > > massage , bool fixedSort , Func < IDbTransaction > getTransaction , string outerSqlTemplate )
27
+ public DapperResult ( Func < IDbConnection > getConnection , string sql , object param , Func < IDbConnection , IDbTransaction , string , object , IEnumerable < T > > map , Action < IDbConnection , IDbTransaction , IList < T > > massage , bool fixedSort , Func < IDbTransaction > getTransaction , string outerSqlTemplate , int ? commandTimout = null )
27
28
: base ( null )
28
29
{
29
30
_getConnection = getConnection ;
@@ -39,7 +40,7 @@ public DapperResult(Func<IDbConnection> getConnection, string sql, object param,
39
40
_massage = massage ;
40
41
_fixedSort = fixedSort ;
41
42
_getTransaction = getTransaction ;
42
-
43
+ _commandTimeout = commandTimout ;
43
44
}
44
45
45
46
public override void PopulateSummaryValues ( GriddlySettings < T > settings )
@@ -91,7 +92,7 @@ public override IEnumerable<P> GetAllForProperty<P>(string propertyName, SortFie
91
92
IDbConnection cn = _getConnection ( ) ;
92
93
IDbTransaction tx = _getTransaction != null ? _getTransaction ( ) : null ;
93
94
94
- return cn . Query < P > ( sql , _param , tx ) ;
95
+ return cn . Query < P > ( sql , _param , tx , commandTimeout : _commandTimeout ) ;
95
96
}
96
97
catch ( Exception ex )
97
98
{
@@ -132,7 +133,7 @@ protected virtual X ExecuteSingle<X>(string sql)
132
133
IDbConnection cn = _getConnection ( ) ;
133
134
IDbTransaction tx = _getTransaction != null ? _getTransaction ( ) : null ;
134
135
135
- return cn . Query < X > ( sql , _param , tx ) . Single ( ) ;
136
+ return cn . Query < X > ( sql , _param , tx , commandTimeout : _commandTimeout ) . Single ( ) ;
136
137
}
137
138
138
139
// TODO: return IEnumerable so we don't have to .ToList()
@@ -160,7 +161,7 @@ protected virtual IList<T> ExecuteQuery(string sql)
160
161
161
162
protected IEnumerable < T > DefaultMap ( IDbConnection cn , IDbTransaction tx , string sql , object param )
162
163
{
163
- IEnumerable < T > result = cn . Query < T > ( sql , param , tx ) ;
164
+ IEnumerable < T > result = cn . Query < T > ( sql , param , tx , commandTimeout : _commandTimeout ) ;
164
165
165
166
var firstRow = result . FirstOrDefault ( ) ;
166
167
long ? overallCount = null ;
0 commit comments