38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
|
|||
|
|
|
||
|
|
using Autofac;
|
||
|
|
using CommonService;
|
||
|
|
using FishRoomService.RoomService;
|
||
|
|
using MongoRepository;
|
||
|
|
|
||
|
|
namespace FishRoomHost.Middleware
|
||
|
|
{
|
||
|
|
public class AutofacModule : Module
|
||
|
|
{
|
||
|
|
protected override void Load(ContainerBuilder builder)
|
||
|
|
{
|
||
|
|
builder.RegisterGeneric(typeof(MongoBaseRepository<>)).As(typeof(IMongoBaseRepository<>)).InstancePerLifetimeScope();
|
||
|
|
builder.RegisterGeneric(typeof(MongoBaseService<>)).As(typeof(IMongoBaseService<>)).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(FishingRoomService).Assembly)
|
||
|
|
.Where(t => t.Name.EndsWith("Service"))
|
||
|
|
.AsImplementedInterfaces()
|
||
|
|
.InstancePerLifetimeScope();
|
||
|
|
builder.RegisterAssemblyTypes(typeof(UserService.User.UserService).Assembly)
|
||
|
|
.Where(t => t.Name.EndsWith("Service"))
|
||
|
|
.AsImplementedInterfaces()
|
||
|
|
.InstancePerLifetimeScope();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|