Npgsql.NpgsqlCommand.CheckConnectionState C# (CSharp) Méthode

CheckConnectionState() private méthode

This method checks the connection state to see if the connection is set or it is open. If one of this conditions is not met, throws an InvalidOperationException
private CheckConnectionState ( ) : void
Résultat void
        private void CheckConnectionState()
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "CheckConnectionState");

            // Check the connection state.
            if (Connector == null || Connector.State == ConnectionState.Closed)
            {
                throw new InvalidOperationException(resman.GetString("Exception_ConnectionNotOpen"));
            }
            if (Connector.State != ConnectionState.Open)
            {
                throw new InvalidOperationException(
                    "There is already an open DataReader associated with this Command which must be closed first.");
            }
        }