Skip to content

Commit 6f1cb08

Browse files
author
zzzprojects
committed
Fix issue from v1.4.6
Fix issue from v1.4.6
1 parent 297dbf8 commit 6f1cb08

File tree

15 files changed

+53
-29
lines changed

15 files changed

+53
-29
lines changed

src/Z.EntityFramework.Plus.EF5.NET40/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
[assembly: AssemblyCulture("")]
1919
[assembly: ComVisible(false)]
2020
[assembly: Guid("e4c2af73-caeb-4429-bcb6-0a359484e064")]
21-
[assembly: AssemblyVersion("1.4.6")]
22-
[assembly: AssemblyFileVersion("1.4.6")]
21+
[assembly: AssemblyVersion("1.4.7")]
22+
[assembly: AssemblyFileVersion("1.4.7")]

src/Z.EntityFramework.Plus.EF5.NET40/QueryCache/QueryCacheManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static string GetCacheKey(IQueryable query, string[] tags)
249249

250250
if (queryCacheUniqueKeyMethod != null)
251251
{
252-
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, null);
252+
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, new object[] { tags });
253253

254254
if (!string.IsNullOrEmpty(queryCacheUniqueKey))
255255
{

src/Z.EntityFramework.Plus.EF5.NET40/QueryIncludeOptimized/QueryIncludeOptimizedParentQueryable`.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,17 @@ public IQueryable Include(string path)
159159
#if FULL
160160
/// <summary>Gets query cache unique key.</summary>
161161
/// <returns>The query cache unique key.</returns>
162-
public string GetQueryCacheUniqueKey()
162+
public string GetQueryCacheUniqueKey(string[] tags)
163163
{
164164
var cacheKey = new StringBuilder();
165165

166-
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, new string[0]);
166+
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, tags);
167+
168+
if (QueryCacheManager.UseFirstTagAsCacheKey || QueryCacheManager.UseTagsAsCacheKey)
169+
{
170+
// ONLY need to resolve once
171+
return mainKey;
172+
}
167173

168174
// ADD query main
169175
cacheKey.AppendLine("Query Main");
@@ -174,7 +180,7 @@ public string GetQueryCacheUniqueKey()
174180
for (var i = 0; i < Childs.Count; i++)
175181
{
176182
var child = Childs[i].GetFilteredQuery(OriginalQueryable);
177-
var childKey = QueryCacheManager.GetCacheKey(child, new string[0]);
183+
var childKey = QueryCacheManager.GetCacheKey(child, tags);
178184

179185
// ADD query child
180186
cacheKey.AppendLine("Query Child: " + i);

src/Z.EntityFramework.Plus.EF5/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
[assembly: AssemblyCulture("")]
1919
[assembly: ComVisible(false)]
2020
[assembly: Guid("abcbb878-043c-4957-a334-90e9872e684e")]
21-
[assembly: AssemblyVersion("1.4.6")]
22-
[assembly: AssemblyFileVersion("1.4.6")]
21+
[assembly: AssemblyVersion("1.4.7")]
22+
[assembly: AssemblyFileVersion("1.4.7")]

src/Z.EntityFramework.Plus.EF5/QueryCache/QueryCacheManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static string GetCacheKey(IQueryable query, string[] tags)
249249

250250
if (queryCacheUniqueKeyMethod != null)
251251
{
252-
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, null);
252+
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, new object[] { tags });
253253

254254
if (!string.IsNullOrEmpty(queryCacheUniqueKey))
255255
{

src/Z.EntityFramework.Plus.EF5/QueryIncludeOptimized/QueryIncludeOptimizedParentQueryable`.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,17 @@ public IQueryable Include(string path)
159159
#if FULL
160160
/// <summary>Gets query cache unique key.</summary>
161161
/// <returns>The query cache unique key.</returns>
162-
public string GetQueryCacheUniqueKey()
162+
public string GetQueryCacheUniqueKey(string[] tags)
163163
{
164164
var cacheKey = new StringBuilder();
165165

166-
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, new string[0]);
166+
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, tags);
167+
168+
if (QueryCacheManager.UseFirstTagAsCacheKey || QueryCacheManager.UseTagsAsCacheKey)
169+
{
170+
// ONLY need to resolve once
171+
return mainKey;
172+
}
167173

168174
// ADD query main
169175
cacheKey.AppendLine("Query Main");
@@ -174,7 +180,7 @@ public string GetQueryCacheUniqueKey()
174180
for (var i = 0; i < Childs.Count; i++)
175181
{
176182
var child = Childs[i].GetFilteredQuery(OriginalQueryable);
177-
var childKey = QueryCacheManager.GetCacheKey(child, new string[0]);
183+
var childKey = QueryCacheManager.GetCacheKey(child, tags);
178184

179185
// ADD query child
180186
cacheKey.AppendLine("Query Child: " + i);

src/Z.EntityFramework.Plus.EF6.NET40/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
[assembly: AssemblyCulture("")]
1919
[assembly: ComVisible(false)]
2020
[assembly: Guid("ac398eb8-0a31-4d06-a804-84d10b6da96d")]
21-
[assembly: AssemblyVersion("1.4.6")]
22-
[assembly: AssemblyFileVersion("1.4.6")]
21+
[assembly: AssemblyVersion("1.4.7")]
22+
[assembly: AssemblyFileVersion("1.4.7")]

src/Z.EntityFramework.Plus.EF6.NET40/QueryCache/QueryCacheManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static string GetCacheKey(IQueryable query, string[] tags)
249249

250250
if (queryCacheUniqueKeyMethod != null)
251251
{
252-
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, null);
252+
var queryCacheUniqueKey = (string)queryCacheUniqueKeyMethod.Invoke(query, new object[] { tags });
253253

254254
if (!string.IsNullOrEmpty(queryCacheUniqueKey))
255255
{

src/Z.EntityFramework.Plus.EF6.NET40/QueryIncludeFilter/QueryIncludeFilterParentQueryable`.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ public IQueryable CreateQueryable()
181181
#if FULL
182182
/// <summary>Gets query cache unique key.</summary>
183183
/// <returns>The query cache unique key.</returns>
184-
public string GetQueryCacheUniqueKey()
184+
public string GetQueryCacheUniqueKey(string[] tags)
185185
{
186186
var query = CreateQueryable();
187187

188-
return QueryCacheManager.GetCacheKey(query, new string[0]);
188+
return QueryCacheManager.GetCacheKey(query, tags);
189189
}
190190
#endif
191191

src/Z.EntityFramework.Plus.EF6.NET40/QueryIncludeOptimized/QueryIncludeOptimizedParentQueryable`.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,17 @@ public IQueryable Include(string path)
159159
#if FULL
160160
/// <summary>Gets query cache unique key.</summary>
161161
/// <returns>The query cache unique key.</returns>
162-
public string GetQueryCacheUniqueKey()
162+
public string GetQueryCacheUniqueKey(string[] tags)
163163
{
164164
var cacheKey = new StringBuilder();
165165

166-
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, new string[0]);
166+
var mainKey = QueryCacheManager.GetCacheKey(OriginalQueryable, tags);
167+
168+
if (QueryCacheManager.UseFirstTagAsCacheKey || QueryCacheManager.UseTagsAsCacheKey)
169+
{
170+
// ONLY need to resolve once
171+
return mainKey;
172+
}
167173

168174
// ADD query main
169175
cacheKey.AppendLine("Query Main");
@@ -174,7 +180,7 @@ public string GetQueryCacheUniqueKey()
174180
for (var i = 0; i < Childs.Count; i++)
175181
{
176182
var child = Childs[i].GetFilteredQuery(OriginalQueryable);
177-
var childKey = QueryCacheManager.GetCacheKey(child, new string[0]);
183+
var childKey = QueryCacheManager.GetCacheKey(child, tags);
178184

179185
// ADD query child
180186
cacheKey.AppendLine("Query Child: " + i);

0 commit comments

Comments
 (0)