25 lines
780 B
C#
25 lines
780 B
C#
using Autofac;
|
|
using Npgsql;
|
|
using System.Data;
|
|
namespace PlanTempus.Database.ModuleRegistry
|
|
{
|
|
|
|
public class DbPostgreSqlModule : Module
|
|
{
|
|
public required string ConnectionString { get; set; }
|
|
|
|
protected override void Load(ContainerBuilder builder)
|
|
{
|
|
Insight.Database.Providers.PostgreSQL.PostgreSQLInsightDbProvider.RegisterProvider();
|
|
|
|
builder.RegisterType<Core.ConnectionFactory.PostgresConnectionFactory>()
|
|
.As<Core.ConnectionFactory.IDbConnectionFactory>()
|
|
.WithParameter(new TypedParameter(typeof(string), ConnectionString))
|
|
.SingleInstance();
|
|
|
|
builder.RegisterType<Core.Sql.SqlOperations>()
|
|
.As<Core.Sql.IDatabaseOperations>();
|
|
}
|
|
}
|
|
|
|
}
|