Autofac register assembly types
问题 In Castle, I used to do the following to register types from a different assembly: Classes.FromAssemblyNamed("MyServer.DAL") .Where(type => type.Name.EndsWith("Repository")) .WithServiceAllInterfaces() .LifestylePerWebRequest(), In Autofac, I change the above code to this: builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies()) .Where(t => t.Name.EndsWith("Repository")) .InstancePerRequest(); Is it correct? 回答1: This is the correct way: builder.RegisterAssemblyTypes(AppDomain