Skip to content

Commit d977773

Browse files
author
Bart Koelman
committed
Removed workaround for dotnet/efcore#21026
1 parent f80310f commit d977773

File tree

4 files changed

+2
-24
lines changed

4 files changed

+2
-24
lines changed

src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs

-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ public sealed class JsonApiOptions : IJsonApiOptions
2222
/// <inheritdoc />
2323
JsonSerializerOptions IJsonApiOptions.SerializerWriteOptions => _lazySerializerWriteOptions.Value;
2424

25-
// Workaround for https://github.com/dotnet/efcore/issues/21026
26-
internal bool DisableTopPagination { get; set; }
27-
internal bool DisableChildrenPagination { get; set; }
28-
2925
/// <inheritdoc />
3026
public string? Namespace { get; set; }
3127

src/JsonApiDotNetCore/Queries/Internal/QueryLayerComposer.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private QueryLayer ComposeTopLayer(IEnumerable<ExpressionInScope> constraints, R
172172
{
173173
Filter = GetFilter(expressionsInTopScope, resourceType),
174174
Sort = GetSort(expressionsInTopScope, resourceType),
175-
Pagination = ((JsonApiOptions)_options).DisableTopPagination ? null : topPagination,
175+
Pagination = topPagination,
176176
Projection = GetProjectionForSparseAttributeSet(resourceType)
177177
};
178178
}
@@ -238,9 +238,7 @@ private IImmutableSet<IncludeElementExpression> ProcessIncludeSet(IImmutableSet<
238238
{
239239
Filter = isToManyRelationship ? GetFilter(expressionsInCurrentScope, resourceType) : null,
240240
Sort = isToManyRelationship ? GetSort(expressionsInCurrentScope, resourceType) : null,
241-
Pagination = isToManyRelationship
242-
? ((JsonApiOptions)_options).DisableChildrenPagination ? null : GetPagination(expressionsInCurrentScope, resourceType)
243-
: null,
241+
Pagination = isToManyRelationship ? GetPagination(expressionsInCurrentScope, resourceType) : null,
244242
Projection = GetProjectionForSparseAttributeSet(resourceType)
245243
};
246244

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Filtering/FilterDepthTests.cs

-8
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ public FilterDepthTests(IntegrationTestContext<TestableStartup<QueryStringDbCont
2727

2828
var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
2929
options.EnableLegacyFilterNotation = false;
30-
31-
options.DisableTopPagination = false;
32-
options.DisableChildrenPagination = false;
3330
}
3431

3532
[Fact]
@@ -370,11 +367,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
370367
await dbContext.SaveChangesAsync();
371368
});
372369

373-
// Workaround for https://github.com/dotnet/efcore/issues/21026
374-
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
375-
options.DisableTopPagination = false;
376-
options.DisableChildrenPagination = true;
377-
378370
const string route = "/blogPosts?include=labels&filter[labels]=equals(name,'Hot')";
379371

380372
// Act

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs

-8
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ public PaginationWithTotalCountTests(IntegrationTestContext<TestableStartup<Quer
3434
options.MaximumPageSize = null;
3535
options.MaximumPageNumber = null;
3636
options.AllowUnknownQueryStringParameters = true;
37-
38-
options.DisableTopPagination = false;
39-
options.DisableChildrenPagination = false;
4037
}
4138

4239
[Fact]
@@ -350,11 +347,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
350347
await dbContext.SaveChangesAsync();
351348
});
352349

353-
// Workaround for https://github.com/dotnet/efcore/issues/21026
354-
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
355-
options.DisableTopPagination = true;
356-
options.DisableChildrenPagination = false;
357-
358350
const string route = "/blogPosts?include=labels&page[number]=labels:2&page[size]=labels:1";
359351

360352
// Act

0 commit comments

Comments
 (0)