Skip to content

Commit 4f74f04

Browse files
Merge pull request #419 from sqlkata/fix/get-dictionnary-async-null
fix GetDictionaryAsync returns null https://github.com/sqlkata/queryb…
2 parents 92eaeb0 + 2bcaac1 commit 4f74f04

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

SqlKata.Execution/QueryFactory.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ public IEnumerable<IDictionary<string, object>> GetDictionary(Query query, IDbTr
107107
{
108108
var compiled = CompileAndLog(query);
109109

110-
return this.Connection.Query(
110+
var result = this.Connection.Query(
111111
compiled.Sql,
112112
compiled.NamedBindings,
113113
transaction: transaction,
114114
commandTimeout: timeout ?? this.QueryTimeout
115-
) as IEnumerable<IDictionary<string, object>>;
115+
);
116+
117+
return result.Cast<IDictionary<string, object>>();
116118
}
117119

118120
public async Task<IEnumerable<IDictionary<string, object>>> GetDictionaryAsync(Query query, IDbTransaction transaction = null, int? timeout = null)
@@ -126,7 +128,7 @@ public async Task<IEnumerable<IDictionary<string, object>>> GetDictionaryAsync(Q
126128
commandTimeout: timeout ?? this.QueryTimeout
127129
);
128130

129-
return result as IEnumerable<IDictionary<string, object>>;
131+
return result.Cast<IDictionary<string, object>>();
130132
}
131133

132134
public IEnumerable<dynamic> Get(Query query, IDbTransaction transaction = null, int? timeout = null)

0 commit comments

Comments
 (0)