C# Class Npgsql.NpgsqlConnection

Inheritance: System.Data.Common.DbConnection, ICloneable
Afficher le fichier Open project: undeadlabs/Npgsql Class Usage Examples

Private Properties

Свойство Type Description
CheckConnectionClosed void
CheckConnectionOpen void
CheckNotDisposed void
CopyConnectionStringBuilder NpgsqlConnectionStringBuilder
DefaultCertificateSelectionCallback System.Security.Cryptography.X509Certificates.X509Certificate
DefaultCertificateValidationCallback bool
DefaultPrivateKeySelectionCallback System.Security.Cryptography.AsymmetricAlgorithm
DefaultProvideClientCertificatesCallback void
DefaultValidateRemoteCertificateCallback bool
EmergencyClose void
ICloneable Object
Init void
LoadConnectionStringBuilder void
LoadConnectionStringBuilder void
LogConnectionString void
OnNotice void
OnNotification void
PromotableLocalTransactionEnded void
ReallyClose void
RefreshConnectionString void

Méthodes publiques

Méthode Description
BeginTransaction ( ) : NpgsqlTransaction

Begins a database transaction.

Currently there's no support for nested transactions.

BeginTransaction ( System.Data.IsolationLevel level ) : NpgsqlTransaction

Begins a database transaction with the specified isolation level.

Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. There's no support for nested transactions.

ChangeDatabase ( String dbName ) : void

This method changes the current database by disconnecting from the actual database and connecting to the specified.

ClearAllPools ( ) : void

Clear all connection pools.

ClearPool ( ) : void

Clear connection pool.

Clone ( ) : NpgsqlConnection

Create a new connection based on this one.

Close ( ) : void

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.

CreateCommand ( ) : NpgsqlCommand

Creates and returns a NpgsqlCommand object associated with the NpgsqlConnection.

EnlistTransaction ( Transaction transaction ) : void

Enlist transation.

GetSchema ( ) : DataTable

Returns the supported collections

GetSchema ( string collectionName ) : DataTable

Returns the schema collection specified by the collection name.

GetSchema ( string collectionName, string restrictions ) : DataTable

Returns the schema collection specified by the collection name filtered by the restrictions.

NpgsqlConnection ( ) : System

Initializes a new instance of the NpgsqlConnection class.

NpgsqlConnection ( NpgsqlConnectionStringBuilder ConnectionString ) : System

Initializes a new instance of the NpgsqlConnection class and sets the ConnectionString.

NpgsqlConnection ( String ConnectionString ) : System

Initializes a new instance of the NpgsqlConnection class and sets the ConnectionString.

Open ( ) : void

Opens a database connection with the property settings specified by the ConnectionString.

Méthodes protégées

Méthode Description
BeginDbTransaction ( System.Data.IsolationLevel isolationLevel ) : DbTransaction

Begins a database transaction with the specified isolation level.

Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. There's no support for nested transactions.

CreateDbCommand ( ) : DbCommand

Creates and returns a DbCommand object associated with the IDbConnection.

Dispose ( bool disposing ) : void

Releases all resources used by the NpgsqlConnection.

Private Methods

Méthode Description
CheckConnectionClosed ( ) : void
CheckConnectionOpen ( ) : void
CheckNotDisposed ( ) : void
CopyConnectionStringBuilder ( ) : NpgsqlConnectionStringBuilder

Returns a copy of the NpgsqlConnectionStringBuilder that contains the parsed connection string values.

DefaultCertificateSelectionCallback ( X509CertificateCollection clientCertificates, X509Certificate serverCertificate, string targetHost, X509CertificateCollection serverRequestedCertificates ) : X509Certificate

Default SSL CertificateSelectionCallback implementation.

DefaultCertificateValidationCallback ( X509Certificate certificate, int certificateErrors ) : bool

Default SSL CertificateValidationCallback implementation.

DefaultPrivateKeySelectionCallback ( X509Certificate certificate, string targetHost ) : AsymmetricAlgorithm

Default SSL PrivateKeySelectionCallback implementation.

DefaultProvideClientCertificatesCallback ( X509CertificateCollection certificates ) : void

Default SSL ProvideClientCertificatesCallback implementation.

DefaultValidateRemoteCertificateCallback ( X509Certificate cert, X509Chain chain, SslPolicyErrors errors ) : bool

Default SSL ValidateRemoteCertificateCallback implementation.

EmergencyClose ( ) : void
ICloneable ( ) : Object

Create a new connection based on this one.

Init ( ) : void
LoadConnectionStringBuilder ( NpgsqlConnectionStringBuilder connectionString ) : void

Sets the `settings` ConnectionStringBuilder based on the given `connectionString`

LoadConnectionStringBuilder ( string connectionString ) : void

Sets the `settings` ConnectionStringBuilder based on the given `connectionString`

LogConnectionString ( ) : void

Write each key/value pair in the connection string to the log.

OnNotice ( object O, Npgsql.NpgsqlNoticeEventArgs E ) : void
OnNotification ( object O, Npgsql.NpgsqlNotificationEventArgs E ) : void
PromotableLocalTransactionEnded ( ) : void

When a connection is closed within an enclosing TransactionScope and the transaction hasn't been promoted, we defer the actual closing until the scope ends.

ReallyClose ( ) : void
RefreshConnectionString ( ) : void

Refresh the cached _connectionString whenever the builder settings change

Method Details

BeginDbTransaction() protected méthode

Begins a database transaction with the specified isolation level.
Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. There's no support for nested transactions.
protected BeginDbTransaction ( System.Data.IsolationLevel isolationLevel ) : DbTransaction
isolationLevel System.Data.IsolationLevel The isolation level under which the transaction should run.
Résultat System.Data.Common.DbTransaction

BeginTransaction() public méthode

Begins a database transaction.
Currently there's no support for nested transactions.
public BeginTransaction ( ) : NpgsqlTransaction
Résultat NpgsqlTransaction

BeginTransaction() public méthode

Begins a database transaction with the specified isolation level.
Currently the IsolationLevel ReadCommitted and Serializable are supported by the PostgreSQL backend. There's no support for nested transactions.
public BeginTransaction ( System.Data.IsolationLevel level ) : NpgsqlTransaction
level System.Data.IsolationLevel The isolation level under which the transaction should run.
Résultat NpgsqlTransaction

ChangeDatabase() public méthode

This method changes the current database by disconnecting from the actual database and connecting to the specified.
public ChangeDatabase ( String dbName ) : void
dbName String The name of the database to use in place of the current database.
Résultat void

ClearAllPools() public static méthode

Clear all connection pools.
public static ClearAllPools ( ) : void
Résultat void

ClearPool() public méthode

Clear connection pool.
public ClearPool ( ) : void
Résultat void

Clone() public méthode

Create a new connection based on this one.
public Clone ( ) : NpgsqlConnection
Résultat NpgsqlConnection

Close() public méthode

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.
public Close ( ) : void
Résultat void

CreateCommand() public méthode

Creates and returns a NpgsqlCommand object associated with the NpgsqlConnection.
public CreateCommand ( ) : NpgsqlCommand
Résultat NpgsqlCommand

CreateDbCommand() protected méthode

Creates and returns a DbCommand object associated with the IDbConnection.
protected CreateDbCommand ( ) : DbCommand
Résultat System.Data.Common.DbCommand

Dispose() protected méthode

Releases all resources used by the NpgsqlConnection.
protected Dispose ( bool disposing ) : void
disposing bool true when called from Dispose(); /// false when being called from the finalizer.
Résultat void

EnlistTransaction() public méthode

Enlist transation.
public EnlistTransaction ( Transaction transaction ) : void
transaction System.Transactions.Transaction
Résultat void

GetSchema() public méthode

Returns the supported collections
public GetSchema ( ) : DataTable
Résultat System.Data.DataTable

GetSchema() public méthode

Returns the schema collection specified by the collection name.
public GetSchema ( string collectionName ) : DataTable
collectionName string The collection name.
Résultat System.Data.DataTable

GetSchema() public méthode

Returns the schema collection specified by the collection name filtered by the restrictions.
public GetSchema ( string collectionName, string restrictions ) : DataTable
collectionName string The collection name.
restrictions string /// The restriction values to filter the results. A description of the restrictions is contained /// in the Restrictions collection. ///
Résultat System.Data.DataTable

NpgsqlConnection() public méthode

Initializes a new instance of the NpgsqlConnection class.
public NpgsqlConnection ( ) : System
Résultat System

NpgsqlConnection() public méthode

Initializes a new instance of the NpgsqlConnection class and sets the ConnectionString.
public NpgsqlConnection ( NpgsqlConnectionStringBuilder ConnectionString ) : System
ConnectionString NpgsqlConnectionStringBuilder The connection used to open the PostgreSQL database.
Résultat System

NpgsqlConnection() public méthode

Initializes a new instance of the NpgsqlConnection class and sets the ConnectionString.
public NpgsqlConnection ( String ConnectionString ) : System
ConnectionString String The connection used to open the PostgreSQL database.
Résultat System

Open() public méthode

Opens a database connection with the property settings specified by the ConnectionString.
public Open ( ) : void
Résultat void