Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@scattered-code
Created September 21, 2020 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scattered-code/57d35178f5570a42036710e8996547d6 to your computer and use it in GitHub Desktop.
Save scattered-code/57d35178f5570a42036710e8996547d6 to your computer and use it in GitHub Desktop.
using System;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Web.Infrastructure
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter
{
public void OnResourceExecuting(ResourceExecutingContext context)
{
context.ValueProviderFactories.Clear();
}
public void OnResourceExecuted(ResourceExecutedContext context)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment