48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|