Back to top
Yas Adel Mehraban (Yashints) | DI

1 post tagged with "DI"

Problem

Let’s assume you want to validate something before a request hits your ASP.NET Core controller’s action method. One of the possible solutions is to create an ActionFilterAttribute and use its OnActionExecutionAsync (in case you like to do it asynchronously) to do the checking. Now if you are depending on something like configuration or even another instance of a class it is going to be tricky.

PublishedOct 04, 2017
Time to read2 min
actionfilterattributeaspnetcoreaspnetmvcRead more