var builder = new ContainerBuilder(); builder.RegisterAssemblyTypes(typeof(MyService).Assembly) .Where(t => t.Name.EndsWith("Service")) .AsImplementedInterfaces(); builder.Populate(someOtherAssembly); var container = builder.Build();
var builder = new ContainerBuilder(); builder.Populate(typeof(MyModule).Assembly); var container = builder.Build();In this example, we register all modules found in the assembly containing MyModule. Each module can contain its own set of registrations. The Autofac ContainerBuilder and the Populate method are part of the Autofac package library.