示例#1
0
        internal void ReallyClose()
        {
            Log.Trace("Really closing connection", Connector.Id);
            _postponingClose = false;

#if !DNXCORE50
            // clear the way for another promotable transaction
            _promotable = null;
#endif

            Connector.Notification -= NotificationDelegate;
            Connector.Notice       -= NoticeDelegate;

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, Connector);
            }
            else
            {
                Connector.Close();

                Connector.ProvideClientCertificatesCallback = null;
                Connector.UserCertificateValidationCallback = null;
            }

            Connector = null;

            OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
        }
示例#2
0
        void ReallyClose()
        {
            Log.Trace("Really closing connection", Connector.Id);
            _postponingClose = false;

            // clear the way for another promotable transaction
            _promotable = null;

            Connector.Notification -= NotificationDelegate;
            Connector.Notice       -= NoticeDelegate;

            /*if (SyncNotification)
             * {
             *
             * }*/

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, Connector);
            }
            else
            {
                Connector.Close();

                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.ValidateRemoteCertificateCallback -= ValidateRemoteCertificateCallbackDelegate;
            }

            Connector = null;

            OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class
        /// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
        /// </summary>
        /// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param>
        public NpgsqlConnection(String ConnectionString)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()");

            NpgsqlConnectionStringBuilder builder = cache[ConnectionString];

            if (builder == null)
            {
                settings = new NpgsqlConnectionStringBuilder(ConnectionString);
            }
            else
            {
                settings = builder.Clone();
            }

            LogConnectionString();

            NoticeDelegate       = new NoticeEventHandler(OnNotice);
            NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#4
0
        void Init()
        {
            NoticeDelegate       = OnNotice;
            NotificationDelegate = OnNotification;

#if !DNXCORE50
            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            _promotable = new NpgsqlPromotableSinglePhaseNotification(this);
#endif
        }
示例#5
0
        void Init()
        {
            NoticeDelegate       = OnNotice;
            NotificationDelegate = OnNotification;

            ProvideClientCertificatesCallbackDelegate = DefaultProvideClientCertificatesCallback;
            ValidateRemoteCertificateCallbackDelegate = DefaultValidateRemoteCertificateCallback;

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            _promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#6
0
        private void Init()
        {
            NoticeDelegate       = new NoticeEventHandler(OnNotice);
            NotificationDelegate = new NotificationEventHandler(OnNotification);

            RemoteCertificateValidationCallback       = DefaultRemoteCertificateValidationCallback;
            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
//            CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback);
//            CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
//            PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);
//            ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback);

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#7
0
        /// <summary>
        /// Releases the connection to the database.  If the connection is pooled, it will be
        ///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
        /// </summary>
        public override void Close()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");

            if (connector != null)
            {
                Promotable.Prepare();
                // clear the way for another promotable transaction
                promotable = null;

                connector.Notification -= NotificationDelegate;
                connector.Notice       -= NoticeDelegate;
                connector.StateChanged -= connector_StateChanged;

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

                if (Pooling)
                {
                    NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);
                }
                else
                {
                    Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                    Connector.CertificateSelectionCallback      -= CertificateSelectionCallbackDelegate;
                    Connector.CertificateValidationCallback     -= CertificateValidationCallbackDelegate;
                    Connector.PrivateKeySelectionCallback       -= PrivateKeySelectionCallbackDelegate;

                    if (Connector.Transaction != null)
                    {
                        Connector.Transaction.Cancel();
                    }

                    Connector.Close();
                }


                connector = null;

                this.OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
            }
        }
示例#8
0
        void ReallyClose()
        {
            _log.Trace("Really closing connection");
            _postponingClose = false;

            // clear the way for another promotable transaction
            _promotable = null;

            Connector.Notification -= NotificationDelegate;
            Connector.Notice       -= NoticeDelegate;

            if (SyncNotification)
            {
                // Disable async notifications for now
                //Connector.RemoveNotificationThread();
            }

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, Connector);
            }
            else
            {
                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.CertificateSelectionCallback      -= CertificateSelectionCallbackDelegate;
                Connector.CertificateValidationCallback     -= CertificateValidationCallbackDelegate;
                Connector.PrivateKeySelectionCallback       -= PrivateKeySelectionCallbackDelegate;
                Connector.ValidateRemoteCertificateCallback -= ValidateRemoteCertificateCallbackDelegate;

                if (Connector.Transaction != null)
                {
                    Connector.Transaction.Cancel();
                }

                Connector.Close();
            }

            Connector = null;

            OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
        }
示例#9
0
        private NpgsqlConnection(NpgsqlConnectionStringBuilder builder)
        {
            this.settings = builder;

            LogConnectionString();


            NoticeDelegate       = new NoticeEventHandler(OnNotice);
            NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
            CertificateValidationCallbackDelegate     = new CertificateValidationCallback(DefaultCertificateValidationCallback);
            CertificateSelectionCallbackDelegate      = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
            PrivateKeySelectionCallbackDelegate       = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class
        /// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
        /// </summary>
        /// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param>
        public NpgsqlConnection(String ConnectionString)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()");

            LoadConnectionStringBuilder(ConnectionString);

            NoticeDelegate       = new NoticeEventHandler(OnNotice);
            NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
            CertificateValidationCallbackDelegate     = new CertificateValidationCallback(DefaultCertificateValidationCallback);
            CertificateSelectionCallbackDelegate      = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
            PrivateKeySelectionCallbackDelegate       = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);
            ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback);

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#11
0
        private void ReallyClose()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ReallyClose");
            _postponingClose = false;

            // clear the way for another promotable transaction
            promotable = null;

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

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

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);
            }
            else
            {
                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.CertificateSelectionCallback      -= CertificateSelectionCallbackDelegate;
                Connector.CertificateValidationCallback     -= CertificateValidationCallbackDelegate;
                Connector.PrivateKeySelectionCallback       -= PrivateKeySelectionCallbackDelegate;

                if (Connector.Transaction != null)
                {
                    Connector.Transaction.Cancel();
                }

                Connector.Close();
            }

            connector = null;
        }
        /// <summary>
        /// Releases the connection to the database.  If the connection is pooled, it will be
        ///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
        /// </summary>
        public override void Close()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");

            if (connector != null)
            {
                Promotable.Prepare();
                // clear the way for another promotable transaction
                promotable = null;

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

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

                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);


                connector = null;
            }
        }
示例#13
0
        private void ReallyClose()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ReallyClose");
            _postponingClose = false;

            // clear the way for another promotable transaction
            promotable = null;

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

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

            NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);

            connector = null;
        }
示例#14
0
        private void ReallyClose()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ReallyClose");
            _postponingClose = false;

            // clear the way for another promotable transaction
            promotable = null;

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

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

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);
            }
            else
            {
                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.CertificateSelectionCallback -= CertificateSelectionCallbackDelegate;
                Connector.CertificateValidationCallback -= CertificateValidationCallbackDelegate;
                Connector.PrivateKeySelectionCallback -= PrivateKeySelectionCallbackDelegate;
                Connector.ValidateRemoteCertificateCallback -= ValidateRemoteCertificateCallbackDelegate;

                if (Connector.Transaction != null)
                {
                    Connector.Transaction.Cancel();
                }

                Connector.Close();
            }

            connector = null;

            this.OnStateChange (new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
        }
示例#15
0
        private void Init()
        {
            NoticeDelegate = new NoticeEventHandler(OnNotice);
            NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
            CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback);
            CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
            PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);
            ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback);

            // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
            // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
            RSACryptoServiceProvider.UseMachineKeyStore = true;

            promotable = new NpgsqlPromotableSinglePhaseNotification(this);
        }
示例#16
0
        void ReallyClose()
        {
            _log.Trace("Really closing connection");
            _postponingClose = false;

            // clear the way for another promotable transaction
            _promotable = null;

            Connector.Notification -= NotificationDelegate;
            Connector.Notice -= NoticeDelegate;

            if (SyncNotification)
            {
                Connector.RemoveNotificationThread();
            }

            if (Pooling)
            {
                NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, Connector);
            }
            else
            {
                Connector.ProvideClientCertificatesCallback -= ProvideClientCertificatesCallbackDelegate;
                Connector.CertificateSelectionCallback -= CertificateSelectionCallbackDelegate;
                Connector.CertificateValidationCallback -= CertificateValidationCallbackDelegate;
                Connector.PrivateKeySelectionCallback -= PrivateKeySelectionCallbackDelegate;
                Connector.ValidateRemoteCertificateCallback -= ValidateRemoteCertificateCallbackDelegate;

                if (Connector.Transaction != null)
                {
                    Connector.Transaction.Cancel();
                }

                Connector.Close();
            }

            Connector = null;

            OnStateChange(new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed));
        }
示例#17
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class
		/// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
		/// </summary>
		/// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param>
		public NpgsqlConnection(String ConnectionString)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()");

            LoadConnectionStringBuilder(ConnectionString);
			
			NoticeDelegate = new NoticeEventHandler(OnNotice);
			NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
			CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback);
			CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
			PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);
            ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback);

			// Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and 
			// http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
			RSACryptoServiceProvider.UseMachineKeyStore = true;

			promotable = new NpgsqlPromotableSinglePhaseNotification(this);
		}
		/// <summary>
		/// Releases the connection to the database.  If the connection is pooled, it will be
		///	made available for re-use.  If it is non-pooled, the actual connection will be shutdown.
		/// </summary>
		public override void Close()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");
            
			if (connector != null)
			{
				Promotable.Prepare();
                // clear the way for another promotable transaction
                promotable = null;

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

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

				NpgsqlConnectorPool.ConnectorPoolMgr.ReleaseConnector(this, connector);


				connector = null;
			
			}
		}
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class
		/// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
		/// </summary>
		/// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param>
		public NpgsqlConnection(String ConnectionString)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()");

			NpgsqlConnectionStringBuilder builder = cache[ConnectionString];
			if (builder == null)
			{
				settings = new NpgsqlConnectionStringBuilder(ConnectionString);
			}
			else
			{
				settings = builder.Clone();
			}

			LogConnectionString();

			NoticeDelegate = new NoticeEventHandler(OnNotice);
			NotificationDelegate = new NotificationEventHandler(OnNotification);

            ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);

			// Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and 
			// http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
			RSACryptoServiceProvider.UseMachineKeyStore = true;

			promotable = new NpgsqlPromotableSinglePhaseNotification(this);
		}