2025-02-11 17:07:01 +01:00
|
|
|
|
using Autofac;
|
2025-03-03 17:40:16 +01:00
|
|
|
|
using PlanTempus.Core.Sql;
|
|
|
|
|
|
using PlanTempus.Core.Sql.ConnectionFactory;
|
|
|
|
|
|
|
2025-02-20 00:23:13 +01:00
|
|
|
|
namespace PlanTempus.Database.ModuleRegistry
|
2025-02-11 17:07:01 +01:00
|
|
|
|
{
|
2025-02-21 23:34:06 +01:00
|
|
|
|
|
2025-03-03 17:40:16 +01:00
|
|
|
|
public class DbPostgreSqlModule : Module
|
2025-02-20 00:23:13 +01:00
|
|
|
|
{
|
|
|
|
|
|
public required string ConnectionString { get; set; }
|
2025-02-21 00:30:04 +01:00
|
|
|
|
|
2025-02-20 00:23:13 +01:00
|
|
|
|
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>()
|
2025-02-21 23:34:06 +01:00
|
|
|
|
.WithParameter(new TypedParameter(typeof(string), ConnectionString))
|
|
|
|
|
|
.SingleInstance();
|
2025-02-21 00:30:04 +01:00
|
|
|
|
|
2025-03-03 17:40:16 +01:00
|
|
|
|
builder.RegisterType<SqlOperations>()
|
|
|
|
|
|
.As<IDatabaseOperations>();
|
2025-02-21 00:30:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-11 17:07:01 +01:00
|
|
|
|
}
|