Files
BuYuHouDuan/AdminSrc/AdminHost/Middleware/AutofacModule.cs
T

48 lines
1.7 KiB
C#
Raw Normal View History

2026-10-12 16:22:04 +08:00
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<RedisService.RedisService>()
.As<RedisService.IRedisService>()
.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<CommonService.BackgroundOperationService>()
.As<CommonService.IBackgroundOperationService>()
.InstancePerLifetimeScope();
}
}
}