diff --git a/src/Microsoft.AspNet.OData.Shared/Formatter/EdmLibHelpers.cs b/src/Microsoft.AspNet.OData.Shared/Formatter/EdmLibHelpers.cs index 855c47f5ae..40800670ce 100644 --- a/src/Microsoft.AspNet.OData.Shared/Formatter/EdmLibHelpers.cs +++ b/src/Microsoft.AspNet.OData.Shared/Formatter/EdmLibHelpers.cs @@ -934,7 +934,8 @@ private static ModelBoundQuerySettings GetMergedPropertyQuerySettings( propertyTypeQuerySettings.PageSize; } - if (mergedQuerySettings.MaxTop == 0 && propertyTypeQuerySettings.MaxTop != 0) + if (!mergedQuerySettings.MaxTop.HasValue || + (mergedQuerySettings.MaxTop == 0 && propertyTypeQuerySettings.MaxTop != 0)) { mergedQuerySettings.MaxTop = propertyTypeQuerySettings.MaxTop; diff --git a/src/Microsoft.AspNet.OData.Shared/Query/DefaultQuerySettings.cs b/src/Microsoft.AspNet.OData.Shared/Query/DefaultQuerySettings.cs index 67685a2826..8204c3a55b 100644 --- a/src/Microsoft.AspNet.OData.Shared/Query/DefaultQuerySettings.cs +++ b/src/Microsoft.AspNet.OData.Shared/Query/DefaultQuerySettings.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNet.OData.Query /// public class DefaultQuerySettings { - private int? _maxTop = 0; + private int? _maxTop; /// /// Gets or sets a value indicating whether navigation property can be expanded. diff --git a/src/Microsoft.AspNet.OData.Shared/Query/ModelBoundQuerySettings.cs b/src/Microsoft.AspNet.OData.Shared/Query/ModelBoundQuerySettings.cs index b3cce60858..c53e94d610 100644 --- a/src/Microsoft.AspNet.OData.Shared/Query/ModelBoundQuerySettings.cs +++ b/src/Microsoft.AspNet.OData.Shared/Query/ModelBoundQuerySettings.cs @@ -18,10 +18,7 @@ public class ModelBoundQuerySettings private Dictionary _orderByConfigurations = new Dictionary(); private Dictionary _filterConfigurations = new Dictionary(); - internal static ModelBoundQuerySettings DefaultModelBoundQuerySettings = new ModelBoundQuerySettings - { - _maxTop = 0 - }; + internal static ModelBoundQuerySettings DefaultModelBoundQuerySettings = new ModelBoundQuerySettings(); /// /// Instantiates a new instance of the class