December 2019
Intermediate to advanced
510 pages
11h 33m
English
As we already said, Dependency injection is a core technique in ASP.NET Core. Filters usually rely on other components to provide the filter logic. Before discussing injecting dependencies in filters, we need to understand the life cycle process. In general, when we apply a filter as an attribute, the life cycle of the filter is restricted to the request, which means that it is reinitialized for each request. The ServiceFilter attribute provides a valid alternative to overriding this kind of behavior. Therefore, the ServiceFilter attribute uses the service provider to create filter objects, which means that our filter is managed just like any other service declared through the dependency injection system ...