Class RequestMessageValidationFilter
Filter responsible for validating DataAnnotation of the requests that inherit from RequestMessage.
Inheritance
System.Object
RequestMessageValidationFilter
Namespace: StoneCo.Framework.Host.Api.Filters
Assembly: cs.temp.dll.dll
Syntax
public class RequestMessageValidationFilter : ActionFilterAttribute
Constructors
RequestMessageValidationFilter()
Default constructor to validate the request message.
Declaration
public RequestMessageValidationFilter()
Examples
In the host layer into configuration folder, create a new file that's name MvcOptionsConfigurations.
Create a new method as below.
public static MvcOptions ConfigureFilters(this MvcOptions options, IConfiguration configuration)
{
options.Filters.Add(new RequestMessageValidationFilter());
return options;
}
RequestMessageValidationFilter(IEnumerable<String>)
Default constructor to validate the request message with include new header keys.
Declaration
public RequestMessageValidationFilter(IEnumerable<string> headerKeysToExtract)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | headerKeysToExtract | New keys for header. |
Examples
In the host layer into configuration folder, create a new file that's name MvcOptionsConfigurations.
Create a new method as below.
public static MvcOptions ConfigureFilters(this MvcOptions options, IConfiguration configuration)
{
var headerKeysToExtract = new List<string>() { Headers.Brand };
options.Filters.Add(new RequestMessageFilter(headerKeysToExtract));
return options;
}
Methods
OnActionExecuting(ActionExecutingContext)
The call that happens before the method action is performed.
Declaration
public override void OnActionExecuting(ActionExecutingContext context)
Parameters
Type | Name | Description |
---|---|---|
ActionExecutingContext | context | Context to action. |