I can register all Autofac
modules (classes derived from Autofac.Module) one by one using line like this
builder.RegisterModule(new LoggingInjectionModule());
But if I have 10 or more modules I want just to specify assembly, where Autofac
can find all modules, that it need to register. Is there is any way to register all modules from specific assembly, namespace by single line or two lines?
You can use the different overloads (see API doc) of the RegisterAssemblyModules
method:
builder.RegisterAssemblyModules(Assembly.GetExecutingAssembly());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With