2021-08-27 15:03:47 +00:00
|
|
|
using Autofac;
|
2020-12-19 10:55:35 +00:00
|
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
namespace PluralKit.Core;
|
|
|
|
|
|
|
|
public class DataStoreModule: Module
|
2020-12-19 10:55:35 +00:00
|
|
|
{
|
2021-11-27 02:10:56 +00:00
|
|
|
protected override void Load(ContainerBuilder builder)
|
2020-12-19 10:55:35 +00:00
|
|
|
{
|
2021-11-27 02:10:56 +00:00
|
|
|
builder.RegisterType<DbConnectionCountHolder>().SingleInstance();
|
|
|
|
builder.RegisterType<DatabaseMigrator>().SingleInstance();
|
|
|
|
builder.RegisterType<Database>().As<IDatabase>().SingleInstance();
|
|
|
|
builder.RegisterType<ModelRepository>().AsSelf().SingleInstance();
|
2021-08-27 15:03:47 +00:00
|
|
|
|
2022-01-13 17:26:25 +00:00
|
|
|
builder.RegisterType<RedisService>().AsSelf().SingleInstance();
|
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
builder.RegisterType<DispatchService>().AsSelf().SingleInstance();
|
2021-11-02 10:08:17 +00:00
|
|
|
|
2021-11-27 02:10:56 +00:00
|
|
|
builder.Populate(new ServiceCollection().AddMemoryCache());
|
2020-12-19 10:55:35 +00:00
|
|
|
}
|
|
|
|
}
|