Skip to content

Commit 65ba7c5

Browse files
author
Bart Koelman
committed
Removed workaround for dotnet/efcore#21026
1 parent ea0db92 commit 65ba7c5

File tree

5 files changed

+2
-31
lines changed

5 files changed

+2
-31
lines changed

src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ public sealed class JsonApiOptions : IJsonApiOptions
1212
{
1313
internal static readonly NamingStrategy DefaultNamingStrategy = new CamelCaseNamingStrategy();
1414

15-
// Workaround for https://github.com/dotnet/efcore/issues/21026
16-
internal bool DisableTopPagination { get; set; }
17-
internal bool DisableChildrenPagination { get; set; }
18-
1915
/// <inheritdoc />
2016
public string Namespace { get; set; }
2117

src/JsonApiDotNetCore/Queries/Internal/QueryLayerComposer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private QueryLayer ComposeTopLayer(IEnumerable<ExpressionInScope> constraints, R
100100
{
101101
Filter = GetFilter(expressionsInTopScope, resourceContext),
102102
Sort = GetSort(expressionsInTopScope, resourceContext),
103-
Pagination = ((JsonApiOptions)_options).DisableTopPagination ? null : topPagination,
103+
Pagination = topPagination,
104104
Projection = GetProjectionForSparseAttributeSet(resourceContext)
105105
};
106106
}
@@ -164,7 +164,7 @@ private IReadOnlyCollection<IncludeElementExpression> ProcessIncludeSet(IReadOnl
164164
{
165165
Filter = GetFilter(expressionsInCurrentScope, resourceContext),
166166
Sort = GetSort(expressionsInCurrentScope, resourceContext),
167-
Pagination = ((JsonApiOptions)_options).DisableChildrenPagination ? null : GetPagination(expressionsInCurrentScope, resourceContext),
167+
Pagination = GetPagination(expressionsInCurrentScope, resourceContext),
168168
Projection = GetProjectionForSparseAttributeSet(resourceContext)
169169
};
170170

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

-8
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public FilterDepthTests(ExampleIntegrationTestContext<TestableStartup<QueryStrin
2828

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

3633
[Fact]
@@ -327,11 +324,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
327324
await dbContext.SaveChangesAsync();
328325
});
329326

330-
// Workaround for https://github.com/dotnet/efcore/issues/21026
331-
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
332-
options.DisableTopPagination = false;
333-
options.DisableChildrenPagination = true;
334-
335327
const string route = "/blogPosts?include=labels&filter[labels]=equals(name,'Hot')";
336328

337329
// Act

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

-8
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ public PaginationWithTotalCountTests(ExampleIntegrationTestContext<TestableStart
3636
options.MaximumPageSize = null;
3737
options.MaximumPageNumber = null;
3838
options.AllowUnknownQueryStringParameters = true;
39-
40-
options.DisableTopPagination = false;
41-
options.DisableChildrenPagination = false;
4239
}
4340

4441
[Fact]
@@ -303,11 +300,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
303300
await dbContext.SaveChangesAsync();
304301
});
305302

306-
// Workaround for https://github.com/dotnet/efcore/issues/21026
307-
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
308-
options.DisableTopPagination = true;
309-
options.DisableChildrenPagination = false;
310-
311303
const string route = "/blogPosts?include=labels&page[number]=labels:2&page[size]=labels:1";
312304

313305
// Act

test/JsonApiDotNetCoreExampleTests/IntegrationTests/ResourceHooks/ResourceHookTests.cs

-9
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public ResourceHookTests(ExampleIntegrationTestContext<ResourceHooksStartup<AppD
4747

4848
services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>));
4949
});
50-
51-
var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
52-
options.DisableTopPagination = false;
53-
options.DisableChildrenPagination = false;
5450
}
5551

5652
[Fact]
@@ -335,11 +331,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
335331
await dbContext.SaveChangesAsync();
336332
});
337333

338-
// Workaround for https://github.com/dotnet/efcore/issues/21026
339-
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
340-
options.DisableTopPagination = false;
341-
options.DisableChildrenPagination = true;
342-
343334
const string route = "/api/v1/articles?include=tags";
344335

345336
// Act

0 commit comments

Comments
 (0)