Skip to content

Commit

Permalink
Publish V 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
VahidN committed Dec 12, 2023
1 parent 244ad08 commit 139be1a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public T ProcessExecutedCommands<T>(DbCommand command, DbContext? context, T res
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug(CacheableEventId.CacheHit,
"Returning the cached TableRows[{TableName}].",
rowsReader.TableName);
"Returning the cached TableRows[{TableName}].",
rowsReader.TableName);
}

return result;
Expand All @@ -102,7 +102,7 @@ public T ProcessExecutedCommands<T>(DbCommand command, DbContext? context, T res
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug("Skipping a none-cachable command[{CommandText}].",
commandText);
commandText);
}

return result;
Expand All @@ -117,9 +117,9 @@ public T ProcessExecutedCommands<T>(DbCommand command, DbContext? context, T res
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug(CacheableEventId.QueryResultCached,
"[{Data}] added to the cache[{EfCacheKey}].",
data,
efCacheKey);
"[{Data}] added to the cache[{EfCacheKey}].",
data,
efCacheKey);
}
}

Expand All @@ -141,9 +141,9 @@ public T ProcessExecutedCommands<T>(DbCommand command, DbContext? context, T res
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug(CacheableEventId.QueryResultCached,
"TableRows[{TableName}] added to the cache[{EfCacheKey}].",
tableRows.TableName,
efCacheKey);
"TableRows[{TableName}] added to the cache[{EfCacheKey}].",
tableRows.TableName,
efCacheKey);
}
}

Expand All @@ -159,9 +159,9 @@ public T ProcessExecutedCommands<T>(DbCommand command, DbContext? context, T res
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug(CacheableEventId.QueryResultCached,
"[{Result}] added to the cache[{EfCacheKey}].",
result,
efCacheKey);
"[{Result}] added to the cache[{EfCacheKey}].",
result,
efCacheKey);
}
}

Expand Down Expand Up @@ -215,7 +215,7 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re
if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug("Skipping a none-cachable command[{CommandText}].",
commandText);
commandText);
}

return result;
Expand Down Expand Up @@ -243,24 +243,24 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re

using var rows = new EFTableRowsDataReader(new EFTableRows());
return (T)Convert.ChangeType(
InterceptionResult<DbDataReader>.SuppressWithResult(rows),
typeof(T),
CultureInfo.InvariantCulture);
InterceptionResult<DbDataReader>.SuppressWithResult(rows),
typeof(T),
CultureInfo.InvariantCulture);
}

if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger
.LogDebug("Suppressed the result with the TableRows[{TableName}] from the cache[{EfCacheKey}].",
cacheResult.TableRows.TableName,
efCacheKey);
cacheResult.TableRows.TableName,
efCacheKey);
}

using var dataRows = new EFTableRowsDataReader(cacheResult.TableRows);
return (T)Convert.ChangeType(
InterceptionResult<DbDataReader>.SuppressWithResult(dataRows),
typeof(T),
CultureInfo.InvariantCulture);
InterceptionResult<DbDataReader>.SuppressWithResult(dataRows),
typeof(T),
CultureInfo.InvariantCulture);
}

if (result is InterceptionResult<int>)
Expand All @@ -271,14 +271,14 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re
{
_interceptorProcessorLogger
.LogDebug("Suppressed the result with {CachedResult} from the cache[{EfCacheKey}].",
cachedResult,
efCacheKey);
cachedResult,
efCacheKey);
}

return (T)Convert.ChangeType(
InterceptionResult<int>.SuppressWithResult(cachedResult),
typeof(T),
CultureInfo.InvariantCulture);
InterceptionResult<int>.SuppressWithResult(cachedResult),
typeof(T),
CultureInfo.InvariantCulture);
}

if (result is InterceptionResult<object>)
Expand All @@ -289,21 +289,21 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re
{
_interceptorProcessorLogger
.LogDebug("Suppressed the result with {CachedResult} from the cache[{EfCacheKey}].",
cachedResult,
efCacheKey);
cachedResult,
efCacheKey);
}

return (T)Convert.ChangeType(
InterceptionResult<object>
.SuppressWithResult(cachedResult ?? new object()),
typeof(T),
CultureInfo.InvariantCulture);
InterceptionResult<object>
.SuppressWithResult(cachedResult ?? new object()),
typeof(T),
CultureInfo.InvariantCulture);
}

if (_logger.IsLoggerEnabled)
{
_interceptorProcessorLogger.LogDebug("Skipped the result with {Type} type.",
result?.GetType());
result?.GetType());
}

return result;
Expand Down Expand Up @@ -342,7 +342,7 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re
return (true, null);
}

var commandCommandText = command?.CommandText ?? "";
var commandCommandText = command.CommandText ?? "";
var cachePolicy = GetCachePolicy(context, commandCommandText);

if (ShouldSkipQueriesInsideExplicitTransaction(command))
Expand All @@ -358,8 +358,10 @@ public T ProcessExecutingCommands<T>(DbCommand command, DbContext? context, T re
return cachePolicy is null ? (true, null) : (false, cachePolicy);
}

private bool ShouldSkipQueriesInsideExplicitTransaction(DbCommand? command) =>
!_cacheSettings.AllowCachingWithExplicitTransactions && command?.Transaction is not null;
private bool ShouldSkipQueriesInsideExplicitTransaction(DbCommand? command)
{
return !_cacheSettings.AllowCachingWithExplicitTransactions && command?.Transaction is not null;
}

private EFCachePolicy? GetCachePolicy(DbContext context, string commandText)
{
Expand All @@ -378,4 +380,4 @@ private bool ShouldSkipCachingResults(string commandText, object value)

return result;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Entity Framework Core Second Level Caching Library.</Description>
<VersionPrefix>4.1.0</VersionPrefix>
<VersionPrefix>4.1.1</VersionPrefix>
<Authors>Vahid Nasiri</Authors>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0;net462;netcoreapp3.1;</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
2 changes: 1 addition & 1 deletion tag-it.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
git tag -a 4.1.0 -m "Published 4.1.0 to nuget.org"
git tag -a 4.1.1 -m "Published 4.1.1 to nuget.org"
git push --follow-tags
pause

0 comments on commit 139be1a

Please sign in to comment.