11namespace Microsoft . Web . Http . Description
22{
3- using Microsoft . Extensions . DependencyInjection ;
43 using Microsoft . OData . Edm ;
54 using Microsoft . Web . Http . Routing ;
65 using System ;
@@ -34,18 +33,23 @@ public class ODataApiExplorer : VersionedApiExplorer
3433 /// Initializes a new instance of the <see cref="ODataApiExplorer"/> class.
3534 /// </summary>
3635 /// <param name="configuration">The current <see cref="HttpConfiguration">HTTP configuration</see>.</param>
37- public ODataApiExplorer ( HttpConfiguration configuration ) : base ( configuration ) { }
36+ public ODataApiExplorer ( HttpConfiguration configuration ) : this ( configuration , new ODataApiExplorerOptions ( configuration ) ) { }
3837
3938 /// <summary>
40- /// Gets or sets a value indicating whether the API explorer settings are honored.
39+ /// Initializes a new instance of the <see cref="ODataApiExplorer"/> class.
40+ /// </summary>
41+ /// <param name="configuration">The current <see cref="HttpConfiguration">HTTP configuration</see>.</param>
42+ /// <param name="options">The associated <see cref="ODataApiExplorerOptions">API explorer options</see>.</param>
43+ public ODataApiExplorer ( HttpConfiguration configuration , ODataApiExplorerOptions options ) : base ( configuration , options )
44+ {
45+ Options = options ;
46+ }
47+
48+ /// <summary>
49+ /// Gets the options associated with the API explorer.
4150 /// </summary>
42- /// <value>True if the <see cref="ApiExplorerSettingsAttribute"/> is ignored; otherwise, false.
43- /// The default value is <c>false</c>.</value>
44- /// <remarks>Most OData services inherit from the <see cref="ODataController"/>, which excludes the controller
45- /// from the <see cref="IApiExplorer">API explorer</see> by setting <see cref="ApiExplorerSettingsAttribute.IgnoreApi"/>
46- /// to <c>true</c>. By setting this property to <c>false</c>, these settings are ignored instead of reapplying
47- /// <see cref="ApiExplorerSettingsAttribute.IgnoreApi"/> with a value of <c>false</c> to all OData controllers.</remarks>
48- public bool UseApiExplorerSettings { get ; set ; }
51+ /// <value>The <see cref="ODataApiExplorerOptions">API explorer options</see>.</value>
52+ new protected virtual ODataApiExplorerOptions Options { get ; }
4953
5054 /// <summary>
5155 /// Determines whether the action should be considered.
@@ -66,7 +70,7 @@ protected override bool ShouldExploreAction( string actionRouteParameterValue, H
6670 return base . ShouldExploreAction ( actionRouteParameterValue , actionDescriptor , route , apiVersion ) ;
6771 }
6872
69- if ( UseApiExplorerSettings )
73+ if ( Options . UseApiExplorerSettings )
7074 {
7175 var setting = actionDescriptor . GetCustomAttributes < ApiExplorerSettingsAttribute > ( ) . FirstOrDefault ( ) ;
7276
@@ -112,7 +116,7 @@ protected override bool ShouldExploreController( string controllerRouteParameter
112116 return base . ShouldExploreController ( controllerRouteParameterValue , controllerDescriptor , route , apiVersion ) ;
113117 }
114118
115- if ( UseApiExplorerSettings )
119+ if ( Options . UseApiExplorerSettings )
116120 {
117121 var setting = controllerDescriptor . GetCustomAttributes < ApiExplorerSettingsAttribute > ( ) . FirstOrDefault ( ) ;
118122
0 commit comments