I would like to create attribute that will tell that parameter should be filled from action arguments, not from query, route, header or body.
ASP.NET is already binding it correctly from ActionArguments on its own, but I want to prevent it from binding via other means.
I have ActionFilterAttribute for method that set
context.ActionArguments["set"] = filledSet;
So far I'm in my methods I have
[FillSet]
public void MyMethod([FromServices] HashSet<string> set = null)
{
// Do stuff.
}
If I don't use = null I will get
System.InvalidOperationException: No service for type System.Collections.Generic.HashSet1[System.String]' has been registered.
I used FromService so it shouldn't try to bind from other sources.
I would like to have something like
[FillSet]
public void MyMethod([FromActionArguments] HashSet<string> set)
{
// Do stuff.
}
EDIT1: I tried to change it to BindNeverAttribute but now I got
System.InvalidOperationException 'Test.Controllers.TestController.Get (Test)' has more than one parameter that was specified or inferred as bound from request body. Only one parameter per action may be bound from body. ...
