Class DisableModelBindingAttribute
Provides a generic way to disable Microsoft.AspNetCore.Mvc.ModelBinding.IValueProviderFactory implementations used for model binding.
Inheritance
Implements
Inherited Members
Namespace: Cuemon.AspNetCore.Mvc.Filters.ModelBinding
Assembly: Cuemon.AspNetCore.Mvc.dll
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class DisableModelBindingAttribute : Attribute, IAsyncResourceFilter, IFilterMetadata
Remarks
This attribute was inspired by this source on GitHub: https://github.com/aspnet/Entropy/blob/rel/1.1.1/samples/Mvc.FileUpload/Filters/DisableFormValueModelBindingAttribute.cs.
Constructors
| Improve this DocDisableModelBindingAttribute(Type)
Initializes a new instance of the DisableModelBindingAttribute class.
Declaration
public DisableModelBindingAttribute(Type valueProviderFactoryType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | valueProviderFactoryType | The type that needs to be disabled on class or method level. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.NotSupportedException | Only a type that implements the Microsoft.AspNetCore.Mvc.ModelBinding.IValueProviderFactory interface is supported. |
Properties
| Improve this DocValueProviderFactoryType
Gets the type that needs to be disabled on class or method level.
Declaration
public Type ValueProviderFactoryType { get; }
Property Value
Type | Description |
---|---|
System.Type | The type that needs to be disabled on class or method level. |
Methods
| Improve this DocOnResourceExecutionAsync(ResourceExecutingContext, ResourceExecutionDelegate)
Called asynchronously before the rest of the pipeline.
Declaration
public Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext | context | The Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext. |
Microsoft.AspNetCore.Mvc.Filters.ResourceExecutionDelegate | next | The Microsoft.AspNetCore.Mvc.Filters.ResourceExecutionDelegate. Invoked to execute the next resource filter or the remainder of the pipeline. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task which will complete when the remainder of the pipeline completes. |