PluralKit/PluralKit.Core/Modules/DataStoreModule.cs
2021-08-27 11:03:47 -04:00

20 lines
655 B
C#

using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
namespace PluralKit.Core
{
public class DataStoreModule: Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<DbConnectionCountHolder>().SingleInstance();
builder.RegisterType<DatabaseMigrator>().SingleInstance();
builder.RegisterType<Database>().As<IDatabase>().SingleInstance();
builder.RegisterType<ModelRepository>().AsSelf().SingleInstance();
builder.Populate(new ServiceCollection().AddMemoryCache());
}
}
}