Skip to content

Commit

Permalink
Removed workaround for dotnet/efcore#21026
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Koelman committed Dec 3, 2021
1 parent 3b23f82 commit a03ba2e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
4 changes: 0 additions & 4 deletions src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public sealed class JsonApiOptions : IJsonApiOptions
/// <inheritdoc />
JsonSerializerOptions IJsonApiOptions.SerializerWriteOptions => _lazySerializerWriteOptions.Value;

// Workaround for https://github.com/dotnet/efcore/issues/21026
internal bool DisableTopPagination { get; set; }
internal bool DisableChildrenPagination { get; set; }

/// <inheritdoc />
public string? Namespace { get; set; }

Expand Down
6 changes: 2 additions & 4 deletions src/JsonApiDotNetCore/Queries/Internal/QueryLayerComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private QueryLayer ComposeTopLayer(IEnumerable<ExpressionInScope> constraints, R
{
Filter = GetFilter(expressionsInTopScope, resourceType),
Sort = GetSort(expressionsInTopScope, resourceType),
Pagination = ((JsonApiOptions)_options).DisableTopPagination ? null : topPagination,
Pagination = topPagination,
Projection = GetProjectionForSparseAttributeSet(resourceType)
};
}
Expand Down Expand Up @@ -238,9 +238,7 @@ private IImmutableSet<IncludeElementExpression> ProcessIncludeSet(IImmutableSet<
{
Filter = isToManyRelationship ? GetFilter(expressionsInCurrentScope, resourceType) : null,
Sort = isToManyRelationship ? GetSort(expressionsInCurrentScope, resourceType) : null,
Pagination = isToManyRelationship
? ((JsonApiOptions)_options).DisableChildrenPagination ? null : GetPagination(expressionsInCurrentScope, resourceType)
: null,
Pagination = isToManyRelationship ? GetPagination(expressionsInCurrentScope, resourceType) : null,
Projection = GetProjectionForSparseAttributeSet(resourceType)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public FilterDepthTests(IntegrationTestContext<TestableStartup<QueryStringDbCont

var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
options.EnableLegacyFilterNotation = false;

options.DisableTopPagination = false;
options.DisableChildrenPagination = false;
}

[Fact]
Expand Down Expand Up @@ -370,11 +367,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
await dbContext.SaveChangesAsync();
});

// Workaround for https://github.com/dotnet/efcore/issues/21026
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
options.DisableTopPagination = false;
options.DisableChildrenPagination = true;

const string route = "/blogPosts?include=labels&filter[labels]=equals(name,'Hot')";

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public PaginationWithTotalCountTests(IntegrationTestContext<TestableStartup<Quer
options.MaximumPageSize = null;
options.MaximumPageNumber = null;
options.AllowUnknownQueryStringParameters = true;

options.DisableTopPagination = false;
options.DisableChildrenPagination = false;
}

[Fact]
Expand Down Expand Up @@ -350,11 +347,6 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
await dbContext.SaveChangesAsync();
});

// Workaround for https://github.com/dotnet/efcore/issues/21026
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
options.DisableTopPagination = true;
options.DisableChildrenPagination = false;

const string route = "/blogPosts?include=labels&page[number]=labels:2&page[size]=labels:1";

// Act
Expand Down

0 comments on commit a03ba2e

Please sign in to comment.