Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

MvcOptions Class

Definition

Namespace:
Microsoft.AspNetCore.Mvc
Assembly:
Microsoft.AspNetCore.Mvc.Core.dll
Package:
Microsoft.AspNetCore.Mvc.Core v1.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v1.1.0
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.1.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.6
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.19
Package:
Microsoft.AspNetCore.App.Ref v9.0.8
Source:
MvcOptions.cs
Source:
MvcOptions.cs
Source:
MvcOptions.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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 MvcOptionsImplements IEnumerable(Of ICompatibilitySwitch)
Inheritance
MvcOptions
Implements

Constructors

NameDescription
MvcOptions()

Creates a new instance ofMvcOptions.

Properties

NameDescription
AllowBindingHeaderValuesToNonStringModelTypes

Gets or sets a value that determines ifHeaderModelBinder should bind to types other thanString or a collection ofString. If set totrue,HeaderModelBinder would bind to simple types (likeString,Int32,Enum,Boolean etc.) or a collection of simple types. The default value of theproperty isfalse.

AllowCombiningAuthorizeFilters

Gets or sets a value that determines if policies on instances ofAuthorizeFilterwill be combined into a single effective policy. The default value of the property isfalse.

AllowEmptyInputInBodyModelBinding

Gets or sets the flag which decides whether body model binding (for example, on anaction method parameter withFromBodyAttribute) should treat emptyinput as valid.false by default.

AllowShortCircuitingValidationWhenNoValidatorsArePresent

Gets or sets a value that determines ifValidationVisitorcan 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 handlerparameters, or page model properties are validated (in addition to validating their elements orproperties). If set totrue,BindRequiredAttribute andValidationAttributes 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 forresponse caching.

Conventions

Gets a list ofIApplicationModelConvention instances that will be applied totheApplicationModel when discovering actions.

EnableActionInvokers

Gets or sets the flag that determines if MVC should use action invoker extensibility. This will allowcustomIActionInvokerFactory andIActionInvokerProvider execute during the request pipeline.

EnableEndpointRouting

Gets or sets a value that determines if routing should use endpoints internally, or if legacy routinglogic should be used. Endpoint routing is used to match HTTP requests to MVC actions, and to generateURLs withIUrlHelper.

Filters

Gets a collection ofIFilterMetadata which are used to construct filters thatapply 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 anIInputFormatter.The default value of the property isAllExceptions.

InputFormatters

Gets a list ofIInputFormatters that are used by this application.

MaxIAsyncEnumerableBufferLimit

Gets or sets the most number of entries of anIAsyncEnumerable<T> thatthatObjectResultExecutor will buffer.

WhenValue is an instance ofIAsyncEnumerable<T>,ObjectResultExecutor will eagerly read the enumeration and add to a synchronous collectionprior 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 modelbinding system will throw anInvalidOperationException.

MaxModelBindingRecursionDepth

Gets or sets the maximum recursion depth of the model binding system. TheDefaultModelBindingContext will throw anInvalidOperationException if more thanthis number ofIModelBinders are on the stack. That is, an attempt to recurse beyond thislevel will fail.

MaxModelValidationErrors

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

MaxValidationDepth

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

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

When notnull,ValidationVisitor will throw iftraversing an object exceeds the maximum allowed validation depth.

ModelBinderProviders

Gets a list ofIModelBinderProviders used by this application.

ModelBindingMessageProvider

Gets the defaultModelBindingMessageProvider. Changes here are copied to theModelBindingMessageProvider property of allModelMetadatainstances unless overridden in a customIBindingMetadataProvider.

ModelMetadataDetailsProviders

Gets a list ofIMetadataDetailsProvider instances that will be used tocreateModelMetadata instances.

ModelValidatorProviders

Gets a list ofIModelValidatorProviders used by this application.

OutputFormatters

Gets a list ofIOutputFormatters that are used by this application.

RequireHttpsPermanent

Gets or sets the default value for the Permanent property ofRequireHttpsAttribute.

RespectBrowserAcceptHeader

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

ReturnHttpNotAcceptable

Gets or sets the flag which decides whether an HTTP 406 Not Acceptable responsewill 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 whenRequireHttpsAttributeis 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 tocontroller action names.

ActionName is used to construct the route to the action aswell as in view lookup. Whentrue, MVC will trim the suffix "Async" appliedto action method names.For example, the action name forProductsController.ListProductsAsync will becanonicalized asListProducts.. Consequently, it will be routeable at/Products/ListProducts with views looked up at/Views/Products/ListProducts.cshtml.

This option does not affect values specified usingActionNameAttribute.

SuppressBindingUndefinedValueToEnumType

Gets or sets a value indicating whether the model binding system will bind undefined values toenum types. The default value of the property isfalse.

SuppressImplicitRequiredAttributeForNonNullableReferenceTypes

Gets or sets a value that determines if the inference ofRequiredAttribute forproperties and parameters of non-nullable reference types is suppressed. Iffalse(the default), then all non-nullable reference types will behave as-if[Required] hasbeen applied. Iftrue, this behavior will be suppressed; nullable reference types andnon-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 thatsynchronously read from the HTTP request body.

SuppressOutputFormatterBuffering

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

ValidateComplexTypesIfChildValidationFails

Gets or sets a value that determines whether the validation visitor will perform validation of a complex typeif validation fails for any of its children.<seealso cref="P:Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.ValidateComplexTypesIfChildValidationFails"></seealso>

ValueProviderFactories

Gets a list ofIValueProviderFactory used by this application.

Explicit Interface Implementations

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

Applies to


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?