Class DisableModelBindingAttribute
- Assembly
- Cuemon.AspNetCore.Mvc.dll
Provides a generic way to disable Microsoft.AspNetCore.Mvc.ModelBinding.IValueProviderFactory implementations used for model binding.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class DisableModelBindingAttribute : Attribute, IAsyncResourceFilter, IFilterMetadata
- Inheritance
-
DisableModelBindingAttribute
- Implements
-
IAsyncResourceFilterIFilterMetadata
- Inherited Members
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
DisableModelBindingAttribute(Type)
Initializes a new instance of the DisableModelBindingAttribute class.
public DisableModelBindingAttribute(Type valueProviderFactoryType)
Parameters
valueProviderFactoryType
TypeThe type that needs to be disabled on class or method level.
Exceptions
- ArgumentNullException
valueProviderFactoryType
cannot be null.- NotSupportedException
Only a type that implements the Microsoft.AspNetCore.Mvc.ModelBinding.IValueProviderFactory interface is supported.
Properties
ValueProviderFactoryType
Gets the type that needs to be disabled on class or method level.
public Type ValueProviderFactoryType { get; }
Property Value
- Type
The type that needs to be disabled on class or method level.
Methods
OnResourceExecutionAsync(ResourceExecutingContext, ResourceExecutionDelegate)
Called asynchronously before the rest of the pipeline.
public Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
Parameters
context
ResourceExecutingContextThe Microsoft.AspNetCore.Mvc.Filters.ResourceExecutingContext.
next
ResourceExecutionDelegateThe Microsoft.AspNetCore.Mvc.Filters.ResourceExecutionDelegate. Invoked to execute the next resource filter or the remainder of the pipeline.