-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FileUploadController - CancellationToken support (DisableFormValueMod…
…elBindingAttribute)
- Loading branch information
Showing
4 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
BlazorAppTest/Infrastructure/DisableFormValueModelBindingAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.ModelBinding; | ||
|
||
namespace BlazorAppTest.Infrastructure; | ||
|
||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | ||
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter | ||
{ | ||
public void OnResourceExecuting(ResourceExecutingContext context) | ||
{ | ||
var factories = context.ValueProviderFactories; | ||
factories.RemoveType<FormValueProviderFactory>(); | ||
factories.RemoveType<FormFileValueProviderFactory>(); | ||
factories.RemoveType<JQueryFormValueProviderFactory>(); | ||
} | ||
|
||
public void OnResourceExecuted(ResourceExecutedContext context) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Havit.Blazor.Documentation.Server/Infrastructure/DisableFormValueModelBindingAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.ModelBinding; | ||
|
||
namespace Havit.Blazor.Documentation.Server.Infrastructure; | ||
|
||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | ||
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter | ||
{ | ||
public void OnResourceExecuting(ResourceExecutingContext context) | ||
{ | ||
var factories = context.ValueProviderFactories; | ||
factories.RemoveType<FormValueProviderFactory>(); | ||
factories.RemoveType<FormFileValueProviderFactory>(); | ||
factories.RemoveType<JQueryFormValueProviderFactory>(); | ||
} | ||
|
||
public void OnResourceExecuted(ResourceExecutedContext context) | ||
{ | ||
} | ||
} |