Skip to content

Commit 6e2d985

Browse files
committed
Minor fixes in relation to the removal of the casting. #603
1 parent 010d618 commit 6e2d985

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

RepoDb.Core/RepoDb/Extensions/DbConnectionExtension.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ internal static IEnumerable<dynamic> ExecuteQueryInternal(this IDbConnection con
198198
{
199199
using (var reader = command.ExecuteReader())
200200
{
201-
var result = DataReader.ToEnumerable(reader, dbFields, connection.GetDbSetting());
201+
var result = DataReader.ToEnumerable(reader, dbFields, connection.GetDbSetting()).AsList();
202202

203203
// Set Cache
204204
if (cacheKey != null)
205205
{
206-
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
206+
cache?.Add(cacheKey, (IEnumerable<dynamic>)result, cacheItemExpiration.GetValueOrDefault(), false);
207207
}
208208

209209
// Return
@@ -320,7 +320,7 @@ internal static async Task<IEnumerable<dynamic>> ExecuteQueryAsyncInternal(this
320320
// Set Cache
321321
if (cacheKey != null)
322322
{
323-
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
323+
cache?.Add(cacheKey, (IEnumerable<dynamic>)result, cacheItemExpiration.GetValueOrDefault(), false);
324324
}
325325

326326
// Return
@@ -567,13 +567,12 @@ private static IEnumerable<TResult> ExecuteQueryInternalForType<TResult>(this ID
567567
{
568568
using (var reader = command.ExecuteReader())
569569
{
570-
var result = DataReader.ToEnumerable<TResult>(reader,
571-
dbFields, connection.GetDbSetting());
570+
var result = DataReader.ToEnumerable<TResult>(reader, dbFields, connection.GetDbSetting()).AsList();
572571

573572
// Set Cache
574573
if (cacheKey != null)
575574
{
576-
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
575+
cache?.Add(cacheKey, (IEnumerable<TResult>)result, cacheItemExpiration.GetValueOrDefault(), false);
577576
}
578577

579578
// Return
@@ -826,7 +825,7 @@ private static async Task<IEnumerable<TResult>> ExecuteQueryAsyncInternalForType
826825
// Set Cache
827826
if (cacheKey != null)
828827
{
829-
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
828+
cache?.Add(cacheKey, (IEnumerable<TResult>)result, cacheItemExpiration.GetValueOrDefault(), false);
830829
}
831830

832831
// Return

0 commit comments

Comments
 (0)