/// <summary>
/// Opens a database connection with the property settings specified by the
/// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
/// </summary>
public override void Open()
{
CheckConnectionClosed();
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");
// Check if there is any missing argument.
if (!settings.ContainsKey(Keywords.Host))
{
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"),
NpgsqlConnectionStringBuilder.GetKeyName(Keywords.Host));
}
if (!settings.ContainsKey(Keywords.UserName) && !settings.ContainsKey(Keywords.IntegratedSecurity))
{
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"),
NpgsqlConnectionStringBuilder.GetKeyName(Keywords.UserName));
}
// Get a Connector. The connector returned is guaranteed to be connected and ready to go.
connector = NpgsqlConnectorPool.ConnectorPoolMgr.RequestConnector(this);
connector.Notice += NoticeDelegate;
connector.Notification += NotificationDelegate;
if (SyncNotification)
{
connector.AddNotificationThread();
}
if (Enlist)
{
Promotable.Enlist(Transaction.Current);
}
}