Skip to content

Commit

Permalink
Minor fixes in relation to the removal of the casting. #603
Browse files Browse the repository at this point in the history
  • Loading branch information
mikependon committed Sep 30, 2020
1 parent 010d618 commit 6e2d985
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions RepoDb.Core/RepoDb/Extensions/DbConnectionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ internal static IEnumerable<dynamic> ExecuteQueryInternal(this IDbConnection con
{
using (var reader = command.ExecuteReader())
{
var result = DataReader.ToEnumerable(reader, dbFields, connection.GetDbSetting());
var result = DataReader.ToEnumerable(reader, dbFields, connection.GetDbSetting()).AsList();

// Set Cache
if (cacheKey != null)
{
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
cache?.Add(cacheKey, (IEnumerable<dynamic>)result, cacheItemExpiration.GetValueOrDefault(), false);
}

// Return
Expand Down Expand Up @@ -320,7 +320,7 @@ internal static async Task<IEnumerable<dynamic>> ExecuteQueryAsyncInternal(this
// Set Cache
if (cacheKey != null)
{
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
cache?.Add(cacheKey, (IEnumerable<dynamic>)result, cacheItemExpiration.GetValueOrDefault(), false);
}

// Return
Expand Down Expand Up @@ -567,13 +567,12 @@ private static IEnumerable<TResult> ExecuteQueryInternalForType<TResult>(this ID
{
using (var reader = command.ExecuteReader())
{
var result = DataReader.ToEnumerable<TResult>(reader,
dbFields, connection.GetDbSetting());
var result = DataReader.ToEnumerable<TResult>(reader, dbFields, connection.GetDbSetting()).AsList();

// Set Cache
if (cacheKey != null)
{
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
cache?.Add(cacheKey, (IEnumerable<TResult>)result, cacheItemExpiration.GetValueOrDefault(), false);
}

// Return
Expand Down Expand Up @@ -826,7 +825,7 @@ private static async Task<IEnumerable<TResult>> ExecuteQueryAsyncInternalForType
// Set Cache
if (cacheKey != null)
{
cache?.Add(cacheKey, result, cacheItemExpiration.GetValueOrDefault(), false);
cache?.Add(cacheKey, (IEnumerable<TResult>)result, cacheItemExpiration.GetValueOrDefault(), false);
}

// Return
Expand Down

0 comments on commit 6e2d985

Please sign in to comment.