PlanTempusApp/Core/ModuleRegistry/DbPostgreSqlModule.cs
Janus Knudsen 269bf50c78 Adds code
2025-01-03 20:21:44 +01:00

22 lines
501 B
C#

using Autofac;
using Npgsql;
using System.Data;
namespace Core.ModuleRegistry
{
public class DbPostgreSqlModule : Module
{
public string ConnectionString { get; set; }
protected override void Load(ContainerBuilder builder)
{
builder.Register(c =>
{
IDbConnection connection = new NpgsqlConnection(ConnectionString);
return connection;
})
.InstancePerLifetimeScope();
//builder.RegisterType<IDbConnection>().As<IDbConnection>().InstancePerLifetimeScope();
}
}
}