This commit is contained in:
Janus Knudsen 2025-03-03 17:40:16 +01:00
parent 71576a4b1f
commit 73a1f11e99
21 changed files with 236 additions and 228 deletions

View file

@ -1,10 +1,11 @@
using Autofac;
using Npgsql;
using System.Data;
using PlanTempus.Core.Sql;
using PlanTempus.Core.Sql.ConnectionFactory;
namespace PlanTempus.Database.ModuleRegistry
{
public class DbPostgreSqlModule : Module
public class DbPostgreSqlModule : Module
{
public required string ConnectionString { get; set; }
@ -12,13 +13,13 @@ namespace PlanTempus.Database.ModuleRegistry
{
Insight.Database.Providers.PostgreSQL.PostgreSQLInsightDbProvider.RegisterProvider();
builder.RegisterType<Core.ConnectionFactory.PostgresConnectionFactory>()
.As<Core.ConnectionFactory.IDbConnectionFactory>()
builder.RegisterType<PostgresConnectionFactory>()
.As<IDbConnectionFactory>()
.WithParameter(new TypedParameter(typeof(string), ConnectionString))
.SingleInstance();
builder.RegisterType<Core.Sql.SqlOperations>()
.As<Core.Sql.IDatabaseOperations>();
builder.RegisterType<SqlOperations>()
.As<IDatabaseOperations>();
}
}