Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the default of MaxTop to null #2192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microsoft.AspNet.OData.Shared/Formatter/EdmLibHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@ private static ModelBoundQuerySettings GetMergedPropertyQuerySettings(
propertyTypeQuerySettings.PageSize;
}

if (mergedQuerySettings.MaxTop == 0 && propertyTypeQuerySettings.MaxTop != 0)
if (!mergedQuerySettings.MaxTop.HasValue ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any need for a test here?

(mergedQuerySettings.MaxTop == 0 && propertyTypeQuerySettings.MaxTop != 0))
{
mergedQuerySettings.MaxTop =
propertyTypeQuerySettings.MaxTop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.AspNet.OData.Query
/// </summary>
public class DefaultQuerySettings
{
private int? _maxTop = 0;
private int? _maxTop;

/// <summary>
/// Gets or sets a value indicating whether navigation property can be expanded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ public class ModelBoundQuerySettings
private Dictionary<string, bool> _orderByConfigurations = new Dictionary<string, bool>();
private Dictionary<string, bool> _filterConfigurations = new Dictionary<string, bool>();

internal static ModelBoundQuerySettings DefaultModelBoundQuerySettings = new ModelBoundQuerySettings
{
_maxTop = 0
};
internal static ModelBoundQuerySettings DefaultModelBoundQuerySettings = new ModelBoundQuerySettings();

/// <summary>
/// Instantiates a new instance of the <see cref="ModelBoundQuerySettings"/> class
Expand Down