Class DisableModelBindingAttribute
- Namespace
- Cuemon.AspNetCore.Mvc.Filters.ModelBinding
- Assembly
- Cuemon.AspNetCore.Mvc.dll
Provides a generic way to disable IValueProviderFactory implementations used for model binding.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
public class DisableModelBindingAttribute : Attribute, IAsyncResourceFilter, IFilterMetadata
- Inheritance
-
DisableModelBindingAttribute
- Implements
- 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
valueProviderFactoryTypeTypeThe type that needs to be disabled on class or method level.
Exceptions
- ArgumentNullException
valueProviderFactoryTypecannot be null.- NotSupportedException
Only a type that implements the 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
contextResourceExecutingContextnextResourceExecutionDelegateThe ResourceExecutionDelegate. Invoked to execute the next resource filter or the remainder of the pipeline.