Support Ad Hoc Model Bound Settings #933
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support Ad Hoc Model Bound Settings
Description
Adds support for OData Model Bound settings using an ad hoc EDM. Developers have the following options:
[Filter("title")]
)a. This is achieved via the
ImplicitModelBoundSettingsConvention
b. In ASP.NET Core, this is wire up automatically via DI
c. In ASP.NET Web API, it must be added explicitly
ODataExplorerOptions
now has apublic VersionedODataModelBuilder AdHocModelBuilder { get; }
property that can be used to:a. Configure ad hoc settings
b. Add conventions specific to ad hoc models
Each convention must be
IModelConfiguration
. If an implementation needs/wants to participate in the discovery process, it must also implementIODataQueryOptionsConvention
, which will be visited for eachApiDescription
.Examples
Assume the following model:
The following configurations will explore the
$filter
query option and indicated that onlytitle
andpublished
are allowed.ASP.NET Core
The basic scenario works without any additional configuration:
The basic scenario works without any additional configuration:
ASP.NET Web API