using AdminService.System; using AdminService.Customer; using AdminService.Admin; using Autofac; using CommonService; using MongoRepository; using UserService; using UserService.BeautifulNumber; namespace AdminHost.Middleware { public class AutofacModule : Module { protected override void Load(ContainerBuilder builder) { builder.RegisterGeneric(typeof(MongoBaseRepository<>)).As(typeof(IMongoBaseRepository<>)).InstancePerLifetimeScope(); builder.RegisterType() .As() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(ApiLogService).Assembly) .Where(t => t.Name.EndsWith("Service")) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(AdminOperationLogService).Assembly) .Where(t => t.Name.EndsWith("Service")) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(SystemService).Assembly) .Where(t => t.Name.EndsWith("Service")) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(UserFeedbackService).Assembly) .Where(t => t.Name.EndsWith("Service")) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterType() .As() .InstancePerLifetimeScope(); } } }