protected PostgresSqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, PostgresSqlDatabaseContextInfo contextInfo)
: base(model, sqlDialect, sqlDataTypeProvider, sqlQueryFormatterManager, contextInfo.DatabaseName, contextInfo)
{
this.SupportsPreparedTransactions = contextInfo.EnablePreparedTransactions;
this.Host = contextInfo.ServerName;
this.UserId = contextInfo.UserId;
this.Password = contextInfo.Password;
this.Port = contextInfo.Port;
var connectionStringBuilder = new NpgsqlConnectionStringBuilder
{
Host = contextInfo.ServerName,
Username = contextInfo.UserId,
Password = contextInfo.Password,
Port = contextInfo.Port,
Pooling = contextInfo.Pooling,
Enlist = false,
MinPoolSize = contextInfo.MinPoolSize,
MaxPoolSize = contextInfo.MaxPoolSize,
KeepAlive = contextInfo.KeepAlive,
ConnectionIdleLifetime = contextInfo.ConnectionIdleLifetime,
ConvertInfinityDateTime = contextInfo.ConvertInfinityDateTime
};
if (contextInfo.Timeout != null)
{
connectionStringBuilder.Timeout = contextInfo.Timeout.Value;
}
if (contextInfo.ConnectionTimeout.HasValue)
{
connectionStringBuilder.Timeout = contextInfo.ConnectionTimeout.Value;
}
if (contextInfo.ConnectionCommandTimeout.HasValue)
{
connectionStringBuilder.CommandTimeout = contextInfo.ConnectionCommandTimeout.Value;
}
connectionStringBuilder.Database = contextInfo.DatabaseName;
this.ConnectionString = connectionStringBuilder.ToString();
connectionStringBuilder.Database = "postgres";
this.ServerConnectionString = connectionStringBuilder.ToString();
this.SchemaManager = new PostgresSqlDatabaseSchemaManager(this);
}