'Is there any .NET 6 DI equivalent to Ninject.Extensions.Factory?

Ninject factory automatically implements the factory class and returns a factory object based on matched type given all the dependencies are resolved. Therefore it is very useful to use ninject.extentions.factory so that we can avoid writing all those if/else cases in the factory class. Now the question is, how do I get the same behavior in .net 6 DI? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source