Search code examples
c#.net-coreautofac.net-5autofac-configuration

Is there a way of registering all interfaces in Autofac for a component using JSON configuration similar to .AsImplementedInterfaces()


Is it possible to have some components registered through JSON in the same way one would register a component with .AsImplementedInterfaces()? Or are modules the only way to do this?

Thank you.


Solution

  • Unfortunately, no, there is not a way via configuration to do AsImplementedInterfaces equivalent. Module is probably the right way to go in this case. Configuration is really more for "I have one or two things I need to swap and it won't be a problem to outline exactly what those things are." It's definitely not intended to replace or be feature-comparable with code-based registration.