I have an IFoo
service implemented by DefaultFoo
, and I've registered it as such in my autofac container.
Now I would like to allow for an alternative implementation of IFoo
to be implemented in a plugin assembly, which can be dropped in a "plugins" folder. How do I configure autofac to prefer this alternative implementation if it is present?
As stated by Memoizer, the latest registration overrides earlier ones. I ended up with something like this:
If you register some interface implementations, Autofac will use the latest registration. Other registrations will be overridden. In your case, Autofac will use the plugin registration, if plugin exists and register own IFoo service implementation.
See Default Registrations