Resolve Open Generics with ASP.NET Cores DI-Container
ASP .NET Core already has quite a decent di-container built in. However, there are some quirks you might need to be aware of. In one of my applications, I’ve been using a factory pattern to register my views by using open generics. To be more clear about that: I have an Interface IView<TView>, and I want to register all of this interfaces implementations. As I found out, Microsofts DI-Container currently doesn’t support that by default (text me if I’m wrong!), but there’s a solution for this problem. Scrutor is a package that adds more complex di-features - specifically scanning. This means that, using this library, you now have the ability to scan through your assemblies and perform registrations based on your findings. ...