How can I use Dependency Injection in a .Net Core ActionFilterAttribute?

As per the documentation, you have a few options here: If your filters have dependencies that you need to access from DI, there are several supported approaches. You can apply your filter to a class or action method using one of the following: ServiceFilterAttribute TypeFilterAttribute IFilterFactory implemented on your attribute ServiceFilter or TypeFilter attributes If … Read more