MvcOptions 類別

定義

提供 MVC 架構的程式設計設定。

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)
繼承
MvcOptions
實作

建構函式

MvcOptions()

建立 MvcOptions 的新執行個體。

屬性

AllowBindingHeaderValuesToNonStringModelTypes

取得或設定值,這個值會判斷是否 HeaderModelBinder 應該系結至 或 集合 String 以外的 String 類型。 如果設定為 trueHeaderModelBinder 則會系結至簡單型別 (,例如 StringInt32EnumBoolean 等等 ) 或簡單類型的集合。 屬性的預設值為 false

AllowCombiningAuthorizeFilters

取得或設定值,這個值會判斷 實例 AuthorizeFilter 上的原則是否會合並成單一有效原則。 屬性的預設值為 false

AllowEmptyInputInBodyModelBinding

取得或設定旗標,決定主體模型系結 (例如,在具有 FromBodyAttribute) 的動作方法參數上,是否應該將空的輸入視為有效。 預設為 false

AllowShortCircuitingValidationWhenNoValidatorsArePresent

取得或設定值,這個值會判斷當模型沒有任何相關聯的驗證程式時,是否可以 ValidationVisitor 進行短線路驗證。

AllowValidatingTopLevelNodes

取得或設定值,這個值會判斷模型系結動作參數、控制器屬性、頁面處理常式參數或頁面模型屬性是否經過驗證 (,以及驗證其專案或屬性) 。 如果設定為 trueBindRequiredAttribute 則會檢查這些最上層節點上的 和 ValidationAttribute 。 否則,會忽略這類屬性。

CacheProfiles

取得 CacheProfile 名稱的字典, CacheProfile 這是預先定義的回應快取設定。

Conventions

取得將在探索動作時套用至 的 ApplicationModel 實例清單 IApplicationModelConvention

EnableActionInvokers

取得或設定旗標,判斷 MVC 是否應該使用動作叫用程式擴充性。 這會允許在要求管線期間自訂 IActionInvokerFactory 和執行 IActionInvokerProvider

EnableEndpointRouting

取得或設定值,這個值會判斷路由是否應該在內部使用端點,或是應該使用舊版路由邏輯。 端點路由可用來比對 HTTP 要求與 MVC 動作,以及使用 IUrlHelper 產生 URL。

Filters

取得 的 IFilterMetadata 集合,用來建構套用至所有動作的篩選。

FormatterMappings

用來指定 URL 格式與對應媒體類型之間的對應。

InputFormatterExceptionPolicy

取得或設定值,這個值會決定模型系結系統如何解譯 所 IInputFormatter 擲回的例外狀況。 屬性的預設值為 AllExceptions

InputFormatters

取得此應用程式所使用的 清單 IInputFormatter

MaxIAsyncEnumerableBufferLimit

取得或設定將緩衝處理的 IAsyncEnumerable<T>ObjectResultExecutor 最多專案數。

當 是 的 IAsyncEnumerable<T> 實例時 ValueObjectResultExecutor 會積極讀取列舉,並在叫用選取的格式器之前新增至同步集合。 這個屬性會決定允許執行程式緩衝處理的大部分專案數目。

MaxModelBindingCollectionSize

取得或設定將複雜集合的大小上限設定為模型系結。 達到此限制時,模型系結系統會擲回 InvalidOperationException

MaxModelBindingRecursionDepth

取得或設定模型系結系統的最大遞迴深度。 如果堆疊上超過這個數目, IModelBinder 則會 DefaultModelBindingContext 擲回 InvalidOperationException 。 也就是說,嘗試遞迴超過此層級將會失敗。

MaxModelValidationErrors

取得或設定此應用程式在忽略進一步錯誤之前允許的驗證錯誤數目上限。

MaxValidationDepth

取得或設定驗證時限制驗證訪客的最大深度。 設定為 null 以停用此功能。

ValidationVisitor 會周遊所正驗證之模型的物件圖形。 針對非常深或無限遞迴的模型,驗證可能會導致堆疊溢位。

當不是 null 時, ValidationVisitor 如果周遊物件超過允許的驗證深度上限,將會擲回 。

ModelBinderProviders

取得此應用程式所使用的 清單 IModelBinderProvider

ModelBindingMessageProvider

取得預設 ModelBindingMessageProvider。 此處的變更會複製到所有 ModelMetadata 實例的 屬性, ModelBindingMessageProvider 除非在自訂 IBindingMetadataProvider 中覆寫。

ModelMetadataDetailsProviders

取得將用來建立 ModelMetadata 實例的 IMetadataDetailsProvider 實例清單。

ModelValidatorProviders

取得此應用程式所使用的 清單 IModelValidatorProvider

OutputFormatters

取得此應用程式所使用的 清單 IOutputFormatter

RequireHttpsPermanent

取得或設定 的 Permanent 屬性的 RequireHttpsAttribute 預設值。

RespectBrowserAcceptHeader

取得或設定旗標,當內容交涉包含媒體類型 / 時,會忽略 Accept 標頭。 預設為 false

ReturnHttpNotAcceptable

取得或設定旗標,這個旗標會決定如果未選取任何格式器來格式化回應,則會傳回 HTTP 406 不可接受的回應。 預設為 false

SslPort

取得或設定使用此應用程式時 RequireHttpsAttribute 所使用的 SSL 埠。 如果未設定埠,則不會在受保護的 URL 中指定埠,例如 https://localhost/path.

SuppressAsyncSuffixInActionNames

取得或設定值,判斷 MVC 是否會移除套用至控制器動作名稱的尾碼 「Async」。

ActionName 用來建構動作的路由,以及在檢視查閱中。 當 時 true ,MVC 會修剪套用至動作方法名稱的尾碼 「Async」。 例如,的動作名稱 ProductsController.ListProductsAsync 將會正式化為 ListProducts. 。 因此,其可透過查閱 的 /Views/Products/ListProducts.cshtml 檢視來路由 /Products/ListProducts 傳送。

此選項不會影響使用 ActionNameAttribute 指定的值。

SuppressBindingUndefinedValueToEnumType

取得或設定值,指出模型系結系統是否會將未定義的值系結至列舉類型。 屬性的預設值為 false

SuppressImplicitRequiredAttributeForNonNullableReferenceTypes

取得或設定值,這個值會判斷是否隱藏不可為 Null 之參考型別之屬性和參數的推斷 RequiredAttribute 。 如果 false (預設) ,則所有不可為 Null 的參考類型都會如已套用一 [Required] 樣運作。 如果 true 為 ,則會隱藏此行為;可為 Null 的參考型別和不可為 Null 的參考型別在驗證時的行為會相同。

SuppressInputFormatterBuffering

取得或設定值,這個值會判斷是否針對從 HTTP 要求本文同步讀取的輸入格式器停用緩衝處理。

SuppressOutputFormatterBuffering

取得或設定旗標,這個旗標會決定是否針對同步寫入 HTTP 回應主體的輸出格式器停用緩衝處理。

ValidateComplexTypesIfChildValidationFails

取得或設定值,這個值會判斷驗證訪客是否會在其任何子系的驗證失敗時執行複雜類型的驗證。

ValueProviderFactories

取得此應用程式所使用的清單 IValueProviderFactory

明確介面實作

IEnumerable.GetEnumerator()

提供 MVC 架構的程式設計設定。

IEnumerable<ICompatibilitySwitch>.GetEnumerator()

提供 MVC 架構的程式設計設定。

適用於