Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0708eaa

Browse files
[main] Source code updates from dotnet/efcore (#3505)
[main] Source code updates from dotnet/efcore
1 parent002b5ba commit0708eaa

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

‎src/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,9 @@ public static IQueryable<TEntity> IgnoreQueryFilters<TEntity>(
27102710
Expression.Call(
27112711
instance:null,
27122712
method:IgnoreNamedQueryFiltersMethodInfo.MakeGenericMethod(typeof(TEntity)),
2713-
arguments:[source.Expression,Expression.Constant(filterKeys)]))
2713+
// converting the collection to an array if it isn't already one to ensure consistent caching. Fixes #37112.
2714+
// #37212 may be a possible future solution providing broader capabilities around parameterizing collections.
2715+
arguments:[source.Expression,Expression.Constant(filterKeysisstring[]?filterKeys:filterKeys.ToArray())]))
27142716
:source;
27152717

27162718
#endregion

‎src/efcore/test/EFCore.Specification.Tests/Query/AdHocQueryFiltersQueryTestBase.cs‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,31 @@ public virtual async Task Named_query_filters_ignore_some()
3434
Assert.Equal(2,result.Count);
3535
}
3636

37+
[ConditionalFact]
38+
publicvirtualasyncTaskNamed_query_filters_caching()
39+
{
40+
varcacheLog=newList<string>();
41+
varcontextFactory=awaitInitializeAsync<Context8576_NamedFilters>(seed: c=>c.SeedAsync(),onConfiguring: builder=>
42+
{
43+
builder.EnableSensitiveDataLogging();
44+
builder.LogTo(cacheLog.Add,filter:(eventid,_)=>eventid.Name==CoreEventId.QueryCompilationStarting.Name);
45+
});
46+
usingvarcontext=contextFactory.CreateContext();
47+
_=context.Entities
48+
.IgnoreQueryFilters(["ActiveFilter","NameFilter"])
49+
.ToList();
50+
_=context.Entities
51+
.IgnoreQueryFilters(["ActiveFilter","NameFilter"])
52+
.ToList();
53+
_=context.Entities
54+
.IgnoreQueryFilters(["NameFilter","ActiveFilter"])
55+
.ToList();
56+
57+
// #37212 - ExpressionEqualityComparer doesn't support collections besides an array,
58+
// therefore we can't implement caching for different order of ignored filters
59+
Assert.Equal(2,cacheLog.Count);
60+
}
61+
3762
[ConditionalFact]
3863
publicvirtualasyncTaskNamed_query_filters_ignore_all()
3964
{

‎src/source-manifest.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"commitSha":"73f1fdca8d9fb191297a7e687790b804f4e78ef5"
3838
},
3939
{
40-
"barId":291637,
40+
"barId":291804,
4141
"path":"efcore",
4242
"remoteUri":"https://github.com/dotnet/efcore",
43-
"commitSha":"fe9cccd98fe3b0897ebb9f47943194bc91be5595"
43+
"commitSha":"5544d0fe9b5b4dd6cc44a14f13b364219b7d8b2e"
4444
},
4545
{
4646
"barId":290921,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp