PlanTempusApp/Database/ModuleRegistry/DbPostgreSqlModule.cs

27 lines
763 B
C#
Raw Normal View History

2025-02-11 17:07:01 +01:00
using Autofac;
2025-03-10 15:56:22 +01:00
using PlanTempus.Core.Database;
using PlanTempus.Core.Database.ConnectionFactory;
2025-03-03 17:40:16 +01:00
namespace PlanTempus.Database.ModuleRegistry
2025-02-11 17:07:01 +01:00
{
2025-03-03 17:40:16 +01:00
public class DbPostgreSqlModule : Module
{
public required string ConnectionString { get; set; }
protected override void Load(ContainerBuilder builder)
{
Insight.Database.Providers.PostgreSQL.PostgreSQLInsightDbProvider.RegisterProvider();
2025-02-11 17:07:01 +01:00
2025-03-03 17:40:16 +01:00
builder.RegisterType<PostgresConnectionFactory>()
.As<IDbConnectionFactory>()
.WithParameter(new TypedParameter(typeof(string), ConnectionString))
.SingleInstance();
2025-03-03 17:40:16 +01:00
builder.RegisterType<SqlOperations>()
.As<IDatabaseOperations>();
}
}
2025-02-11 17:07:01 +01:00
}