PluralKit/PluralKit.Core/Modules/DataStoreModule.cs

23 lines
758 B
C#
Raw Normal View History

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;
namespace PluralKit.Core;
public class DataStoreModule: Module
2020-12-19 10:55:35 +00:00
{
protected override void Load(ContainerBuilder builder)
2020-12-19 10:55:35 +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();
builder.RegisterType<DispatchService>().AsSelf().SingleInstance();
builder.Populate(new ServiceCollection().AddMemoryCache());
2020-12-19 10:55:35 +00:00
}
}