AddNotificationThread() private method

private AddNotificationThread ( ) : void
return void
        /// <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);
            }
        }
Example #2
0
        /// <summary>
        /// Opens a database connection with the property settings specified by the
        /// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
        /// </summary>
        public void Open()
        {
            CheckConnectionClosed();

            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");

            // Check if there is any missing argument.
            if (!connection_string.Contains(ConnectionStringKeys.Host))
            {
                throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.Host);
            }
            if (!connection_string.Contains(ConnectionStringKeys.UserName))
            {
                throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.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();
            }
        }
Example #3
0
        /// <summary>
        /// Opens a database connection with the property settings specified by the
        /// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
        /// </summary>
        public override void Open()
        {
            // If we're postponing a close (see doc on this variable), the connection is already
            // open and can be silently reused
            if (_postponingClose)
            {
                return;
            }

            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, either from the pool or creating one ourselves.
            if (Pooling)
            {
                connector = NpgsqlConnectorPool.ConnectorPoolMgr.RequestConnector(this);
            }
            else
            {
                connector = new NpgsqlConnector(this);

                connector.RemoteCertificateValidationCallback += RemoteCertificateValidationCallback;
//                connector.ProvideClientCertificatesCallback += ProvideClientCertificatesCallbackDelegate;
//                connector.CertificateSelectionCallback += CertificateSelectionCallbackDelegate;
//                connector.CertificateValidationCallback += CertificateValidationCallbackDelegate;
//                connector.PrivateKeySelectionCallback += PrivateKeySelectionCallbackDelegate;
//                connector.ValidateRemoteCertificateCallback += ValidateRemoteCertificateCallbackDelegate;

                connector.Open();
            }

            connector.Notice       += NoticeDelegate;
            connector.Notification += NotificationDelegate;

            if (SyncNotification)
            {
                connector.AddNotificationThread();
            }

            if (Enlist)
            {
                Promotable.Enlist(Transaction.Current);
            }

            this.OnStateChange(new StateChangeEventArgs(ConnectionState.Closed, ConnectionState.Open));
        }
		/// <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);
			}
		}
Example #5
0
        /// <summary>
        /// Opens a database connection with the property settings specified by the
        /// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
        /// </summary>
        public void Open()
        {
            CheckConnectionClosed();

            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");

            // Check if there is any missing argument.
            if (! connection_string.Contains(ConnectionStringKeys.Host))
                throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.Host);
            if (! connection_string.Contains(ConnectionStringKeys.UserName))
                throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.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();
            
        }