How to use Action Filters with Dependency Injection in ASP.NET CORE? : <p>I use constructor-based dependency injection everywhere in my <code>ASP.NET CORE</code> application and I also need to resolve dependencies in my action filters:</p>

<pre><code>public class MyAttribute : ActionFilterAttribute
{
    public int Limit { get; set; } // some custom parameters passed from Action
    private ICustomService CustomService { get; } // this must be resolved

    public MyAttribute()
    {
    }

    public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
    {
        // my code
        ...

        await next();
    }
}
</code></pre>

<p>Then in Controller:</p>

<pre><code>[MyAttribute(Limit = 10)]
public IActionResult()
{
    ...
</code></pre>

<p>If I put ICustomService to the constructor, then I'm unable to compile my project. So, how do I supossed to get interface instances in action filter?</p>
