MvcOptions Class


Provides programmatic configuration for the MVC framework.

public ref class MvcOptions
public ref class MvcOptions : System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Infrastructure::ICompatibilitySwitch ^>
public class MvcOptions
public class MvcOptions : System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Infrastructure.ICompatibilitySwitch>
type MvcOptions = class
type MvcOptions = class
    interface seq<ICompatibilitySwitch>
    interface IEnumerable
Public Class MvcOptions
Public Class MvcOptions
Implements IEnumerable(Of ICompatibilitySwitch)



Creates a new instance of MvcOptions.



Gets or sets a value that determines if HeaderModelBinder should bind to types other than String or a collection of String. If set to true, HeaderModelBinder would bind to simple types (like String, Int32, Enum, Boolean etc.) or a collection of simple types. The default value of the property is false.


Gets or sets a value that determines if policies on instances of AuthorizeFilter will be combined into a single effective policy. The default value of the property is false.


Gets or sets the flag which decides whether body model binding (for example, on an action method parameter with FromBodyAttribute) should treat empty input as valid. false by default.


Gets or sets a value that determines if ValidationVisitor can short-circuit validation when a model does not have any associated validators.


Gets or sets a value that determines if model bound action parameters, controller properties, page handler parameters, or page model properties are validated (in addition to validating their elements or properties). If set to true, BindRequiredAttribute and ValidationAttributes on these top-level nodes are checked. Otherwise, such attributes are ignored.


Gets a Dictionary of CacheProfile Names, CacheProfile which are pre-defined settings for response caching.


Gets a list of IApplicationModelConvention instances that will be applied to the ApplicationModel when discovering actions.


Gets or sets the flag that determines if MVC should use action invoker extensibility. This will allow custom IActionInvokerFactory and IActionInvokerProvider execute during the request pipeline.


Gets or sets a value that determines if routing should use endpoints internally, or if legacy routing logic should be used. Endpoint routing is used to match HTTP requests to MVC actions, and to generate URLs with IUrlHelper.


Gets a collection of IFilterMetadata which are used to construct filters that apply to all actions.


Used to specify mapping between the URL Format and corresponding media type.


Gets or sets a value which determines how the model binding system interprets exceptions thrown by an IInputFormatter. The default value of the property is AllExceptions.


Gets a list of IInputFormatters that are used by this application.


Gets or sets the most number of entries of an IAsyncEnumerable<T> that that ObjectResultExecutor will buffer.

When Value is an instance of IAsyncEnumerable<T>, ObjectResultExecutor will eagerly read the enumeration and add to a synchronous collection prior to invoking the selected formatter. This property determines the most number of entries that the executor is allowed to buffer.


Gets or sets the maximum size of a complex collection to model bind. When this limit is reached, the model binding system will throw an InvalidOperationException.


Gets or sets the maximum recursion depth of the model binding system. The DefaultModelBindingContext will throw an InvalidOperationException if more than this number of IModelBinders are on the stack. That is, an attempt to recurse beyond this level will fail.


Gets or sets the maximum number of validation errors that are allowed by this application before further errors are ignored.


Gets or sets the maximum depth to constrain the validation visitor when validating. Set to null to disable this feature.

ValidationVisitor traverses the object graph of the model being validated. For models that are very deep or are infinitely recursive, validation may result in stack overflow.

When not null, ValidationVisitor will throw if traversing an object exceeds the maximum allowed validation depth.


Gets a list of IModelBinderProviders used by this application.


Gets the default ModelBindingMessageProvider. Changes here are copied to the ModelBindingMessageProvider property of all ModelMetadata instances unless overridden in a custom IBindingMetadataProvider.


Gets a list of IMetadataDetailsProvider instances that will be used to create ModelMetadata instances.


Gets a list of IModelValidatorProviders used by this application.


Gets a list of IOutputFormatters that are used by this application.


Gets or sets the default value for the Permanent property of RequireHttpsAttribute.


Gets or sets the flag which causes content negotiation to ignore Accept header when it contains the media type /. false by default.


Gets or sets the flag which decides whether an HTTP 406 Not Acceptable response will be returned if no formatter has been selected to format the response. false by default.


Gets or sets the SSL port that is used by this application when RequireHttpsAttribute is used. If not set the port won't be specified in the secured URL e.g. https://localhost/path.


Gets or sets a value that determines if MVC will remove the suffix "Async" applied to controller action names.

ActionName is used to construct the route to the action as well as in view lookup. When true, MVC will trim the suffix "Async" applied to action method names. For example, the action name for ProductsController.ListProductsAsync will be canonicalized as ListProducts.. Consequently, it will be routeable at /Products/ListProducts with views looked up at /Views/Products/ListProducts.cshtml.

This option does not affect values specified using ActionNameAttribute.


Gets or sets a value indicating whether the model binding system will bind undefined values to enum types. The default value of the property is false.


Gets or sets a value that determines if the inference of RequiredAttribute for properties and parameters of non-nullable reference types is suppressed. If false (the default), then all non-nullable reference types will behave as-if [Required] has been applied. If true, this behavior will be suppressed; nullable reference types and non-nullable reference types will behave the same for the purposes of validation.


Gets or sets a value that determines if buffering is disabled for input formatters that synchronously read from the HTTP request body.


Gets or sets the flag that determines if buffering is disabled for output formatters that synchronously write to the HTTP response body.


Gets or sets a value that determines whether the validation visitor will perform validation of a complex type if validation fails for any of its children.


Gets a list of IValueProviderFactory used by this application.

Explicit Interface Implementations


Applies to