27 lines
763 B
C#
27 lines
763 B
C#
|
|
using Autofac;
|
|||
|
|
using PlanTempus.Core.Database;
|
|||
|
|
using PlanTempus.Core.Database.ConnectionFactory;
|
|||
|
|
|
|||
|
|
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<PostgresConnectionFactory>()
|
|||
|
|
.As<IDbConnectionFactory>()
|
|||
|
|
.WithParameter(new TypedParameter(typeof(string), ConnectionString))
|
|||
|
|
.SingleInstance();
|
|||
|
|
|
|||
|
|
builder.RegisterType<SqlOperations>()
|
|||
|
|
.As<IDatabaseOperations>();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|