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

Re-add the removed 'QuerySettings' to avoid breaking changes. #891

Merged
merged 1 commit into from
May 1, 2023
Merged
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
47 changes: 7 additions & 40 deletions src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5907,7 +5907,7 @@
<summary>
Read OData item.
</summary>
<param name="reader">The odata reader.</param>
<param name="reader">The OData reader.</param>
<param name="itemsStack">The item stack.</param>
<param name="topLevelItem">The top level item.</param>
</member>
Expand Down Expand Up @@ -6259,7 +6259,7 @@
</member>
<member name="M:Microsoft.AspNetCore.OData.ODataOptions.SkipToken">
<summary>
Enable $skiptop query option.
Enable $skiptoken query option.
</summary>
<returns>The current <see cref="T:Microsoft.AspNetCore.OData.ODataOptions"/> instance to enable fluent configuration.</returns>
</member>
Expand All @@ -6275,6 +6275,11 @@
Gets or sets whether or not the OData system query options should be prefixed with '$'.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.ODataOptions.QuerySettings">
<summary>
Gets the query settings.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.ODataOptions.QueryConfigurations">
<summary>
Gets the query configurations.
Expand Down Expand Up @@ -8022,44 +8027,6 @@
This class describes the default configurations to use during query composition.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableExpand">
<summary>
Gets or sets a value indicating whether navigation property can be expanded.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableSelect">
<summary>
Gets or sets a value indicating whether property can be selected.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableCount">
<summary>
Gets or sets a value indicating whether entity set and property can apply $count.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableOrderBy">
<summary>
Gets or sets a value indicating whether property can apply $orderby.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableFilter">
<summary>
Gets or sets a value indicating whether property can apply $filter.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.MaxTop">
<summary>
Gets or sets the max value of $top that a client can request.
</summary>
<value>
The max value of $top that a client can request, or <c>null</c> if there is no limit.
</value>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations.EnableSkipToken">
<summary>
Gets or sets a value indicating whether the service will use skiptoken or not.
</summary>
</member>
<member name="T:Microsoft.AspNetCore.OData.Query.EnableQueryAttribute">
<summary>
This partial class defines the configuration on <see cref="T:Microsoft.AspNetCore.OData.Query.EnableQueryAttribute"/>.
Expand Down
8 changes: 7 additions & 1 deletion src/Microsoft.AspNetCore.OData/ODataOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public ODataOptions Count()
}

/// <summary>
/// Enable $skiptop query option.
/// Enable $skiptoken query option.
/// </summary>
/// <returns>The current <see cref="ODataOptions"/> instance to enable fluent configuration.</returns>
public ODataOptions SkipToken()
Expand Down Expand Up @@ -287,6 +287,12 @@ public ODataOptions SetMaxTop(int? maxTopValue)
/// </summary>
public bool EnableNoDollarQueryOptions { get; set; } = true;

/// <summary>
/// Gets the query settings.
/// </summary>
[Obsolete("QuerySettings will be removed in the next major version. Use QueryConfigurations instead.")]
public DefaultQuerySettings QuerySettings => QueryConfigurations;

/// <summary>
/// Gets the query configurations.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.AspNetCore.OData/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ Microsoft.AspNetCore.OData.ODataOptions.GetRouteServices(string routePrefix) ->
Microsoft.AspNetCore.OData.ODataOptions.ODataOptions() -> void
Microsoft.AspNetCore.OData.ODataOptions.OrderBy() -> Microsoft.AspNetCore.OData.ODataOptions
Microsoft.AspNetCore.OData.ODataOptions.QueryConfigurations.get -> Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations
Microsoft.AspNetCore.OData.ODataOptions.QuerySettings.get -> Microsoft.OData.ModelBuilder.Config.DefaultQuerySettings
Microsoft.AspNetCore.OData.ODataOptions.QuerySettings.set -> void
Microsoft.AspNetCore.OData.ODataOptions.RouteComponents.get -> System.Collections.Generic.IDictionary<string, (Microsoft.OData.Edm.IEdmModel EdmModel, System.IServiceProvider ServiceProvider)>
Microsoft.AspNetCore.OData.ODataOptions.RouteOptions.get -> Microsoft.AspNetCore.OData.Routing.ODataRouteOptions
Microsoft.AspNetCore.OData.ODataOptions.Select() -> Microsoft.AspNetCore.OData.ODataOptions
Expand Down
57 changes: 5 additions & 52 deletions src/Microsoft.AspNetCore.OData/Query/DefaultQueryConfigurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,16 @@
// </copyright>
//------------------------------------------------------------------------------

using Microsoft.OData.ModelBuilder.Config;

namespace Microsoft.AspNetCore.OData.Query
{
/// <summary>
/// This class describes the default configurations to use during query composition.
/// </summary>
public class DefaultQueryConfigurations
public class DefaultQueryConfigurations : DefaultQuerySettings
{
private int? _maxTop = 0;

/// <summary>
/// Gets or sets a value indicating whether navigation property can be expanded.
/// </summary>
public bool EnableExpand { get; set; }

/// <summary>
/// Gets or sets a value indicating whether property can be selected.
/// </summary>
public bool EnableSelect { get; set; }

/// <summary>
/// Gets or sets a value indicating whether entity set and property can apply $count.
/// </summary>
public bool EnableCount { get; set; }

/// <summary>
/// Gets or sets a value indicating whether property can apply $orderby.
/// </summary>
public bool EnableOrderBy { get; set; }

/// <summary>
/// Gets or sets a value indicating whether property can apply $filter.
/// </summary>
public bool EnableFilter { get; set; }

/// <summary>
/// Gets or sets the max value of $top that a client can request.
/// </summary>
/// <value>
/// The max value of $top that a client can request, or <c>null</c> if there is no limit.
/// </value>
public int? MaxTop
{
get => _maxTop;
set
{
if (value.HasValue && value < 0)
{
throw Error.ArgumentMustBeGreaterThanOrEqualTo("value", value, 0);
}

_maxTop = value;
}
}

/// <summary>
/// Gets or sets a value indicating whether the service will use skiptoken or not.
/// </summary>
public bool EnableSkipToken { get; set; }
// We will add other query settings, for example, $compute, $search here
// In the next major release, we should remove the inheritance from 'DefaultQuerySettings'.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public class Microsoft.AspNetCore.OData.ODataOptions {
bool EnableContinueOnErrorHeader { public get; public set; }
bool EnableNoDollarQueryOptions { public get; public set; }
Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations QueryConfigurations { public get; }
[
ObsoleteAttribute(),
]
Microsoft.OData.ModelBuilder.Config.DefaultQuerySettings QuerySettings { public get; }

[
TupleElementNamesAttribute(),
]
Expand Down Expand Up @@ -1271,16 +1276,8 @@ public class Microsoft.AspNetCore.OData.Query.DefaultODataQueryRequestParser : I
public virtual System.Threading.Tasks.Task`1[[System.String]] ParseAsync (Microsoft.AspNetCore.Http.HttpRequest request)
}

public class Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations {
public class Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations : Microsoft.OData.ModelBuilder.Config.DefaultQuerySettings {
public DefaultQueryConfigurations ()

bool EnableCount { public get; public set; }
bool EnableExpand { public get; public set; }
bool EnableFilter { public get; public set; }
bool EnableOrderBy { public get; public set; }
bool EnableSelect { public get; public set; }
bool EnableSkipToken { public get; public set; }
System.Nullable`1[[System.Int32]] MaxTop { public get; public set; }
}

public class Microsoft.AspNetCore.OData.Query.DefaultSkipTokenHandler : Microsoft.AspNetCore.OData.Query.SkipTokenHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public class Microsoft.AspNetCore.OData.ODataOptions {
bool EnableContinueOnErrorHeader { public get; public set; }
bool EnableNoDollarQueryOptions { public get; public set; }
Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations QueryConfigurations { public get; }
[
ObsoleteAttribute(),
]
Microsoft.OData.ModelBuilder.Config.DefaultQuerySettings QuerySettings { public get; }

[
TupleElementNamesAttribute(),
]
Expand Down Expand Up @@ -1271,16 +1276,8 @@ public class Microsoft.AspNetCore.OData.Query.DefaultODataQueryRequestParser : I
public virtual System.Threading.Tasks.Task`1[[System.String]] ParseAsync (Microsoft.AspNetCore.Http.HttpRequest request)
}

public class Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations {
public class Microsoft.AspNetCore.OData.Query.DefaultQueryConfigurations : Microsoft.OData.ModelBuilder.Config.DefaultQuerySettings {
public DefaultQueryConfigurations ()

bool EnableCount { public get; public set; }
bool EnableExpand { public get; public set; }
bool EnableFilter { public get; public set; }
bool EnableOrderBy { public get; public set; }
bool EnableSelect { public get; public set; }
bool EnableSkipToken { public get; public set; }
System.Nullable`1[[System.Int32]] MaxTop { public get; public set; }
}

public class Microsoft.AspNetCore.OData.Query.DefaultSkipTokenHandler : Microsoft.AspNetCore.OData.Query.SkipTokenHandler {
Expand Down