Dela via


MvcOptions Class

Definition

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)
Inheritance
MvcOptions
Implements

Constructors

MvcOptions()

Creates a new instance of MvcOptions.

Properties

AllowBindingHeaderValuesToNonStringModelTypes

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.

AllowCombiningAuthorizeFilters

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.

AllowEmptyInputInBodyModelBinding

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.

AllowShortCircuitingValidationWhenNoValidatorsArePresent

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

AllowValidatingTopLevelNodes

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.

CacheProfiles

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

Conventions

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

EnableActionInvokers

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.

EnableEndpointRouting

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.

Filters

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

FormatterMappings

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

InputFormatterExceptionPolicy

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.

InputFormatters

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

MaxIAsyncEnumerableBufferLimit

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.

MaxModelBindingCollectionSize

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.

MaxModelBindingRecursionDepth

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.

MaxModelValidationErrors

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

MaxValidationDepth

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.

ModelBinderProviders

Gets a list of IModelBinderProviders used by this application.

ModelBindingMessageProvider

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

ModelMetadataDetailsProviders

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

ModelValidatorProviders

Gets a list of IModelValidatorProviders used by this application.

OutputFormatters

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

RequireHttpsPermanent

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

RespectBrowserAcceptHeader

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

ReturnHttpNotAcceptable

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.

SslPort

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.

SuppressAsyncSuffixInActionNames

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.

SuppressBindingUndefinedValueToEnumType

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.

SuppressImplicitRequiredAttributeForNonNullableReferenceTypes

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.

SuppressInputFormatterBuffering

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

SuppressOutputFormatterBuffering

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

ValidateComplexTypesIfChildValidationFails

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.

ValueProviderFactories

Gets a list of IValueProviderFactory used by this application.

Explicit Interface Implementations

IEnumerable.GetEnumerator()
IEnumerable<ICompatibilitySwitch>.GetEnumerator()

Applies to