C# Класс Npgsql.NpgsqlConnection

Наследование: System.Data.Common.DbConnection, ICloneable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

BeginDbTransaction() защищенный Метод

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.
Результат System.Data.Common.DbTransaction

BeginTransaction() публичный Метод

Begins a database transaction.
Currently there's no support for nested transactions.
public BeginTransaction ( ) : NpgsqlTransaction
Результат NpgsqlTransaction

BeginTransaction() публичный Метод

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.
Результат NpgsqlTransaction

ChangeDatabase() публичный Метод

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.
Результат void

ClearAllPools() публичный статический Метод

Clear all connection pools.
public static ClearAllPools ( ) : void
Результат void

ClearPool() публичный Метод

Clear connection pool.
public ClearPool ( ) : void
Результат void

Clone() публичный Метод

Create a new connection based on this one.
public Clone ( ) : NpgsqlConnection
Результат NpgsqlConnection

Close() публичный Метод

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
Результат void

CreateCommand() публичный Метод

Creates and returns a NpgsqlCommand object associated with the NpgsqlConnection.
public CreateCommand ( ) : NpgsqlCommand
Результат NpgsqlCommand

CreateDbCommand() защищенный Метод

Creates and returns a DbCommand object associated with the IDbConnection.
protected CreateDbCommand ( ) : DbCommand
Результат System.Data.Common.DbCommand

Dispose() защищенный Метод

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.
Результат void

EnlistTransaction() публичный Метод

Enlist transation.
public EnlistTransaction ( Transaction transaction ) : void
transaction System.Transactions.Transaction
Результат void

GetSchema() публичный Метод

Returns the supported collections
public GetSchema ( ) : DataTable
Результат System.Data.DataTable

GetSchema() публичный Метод

Returns the schema collection specified by the collection name.
public GetSchema ( string collectionName ) : DataTable
collectionName string The collection name.
Результат System.Data.DataTable

GetSchema() публичный Метод

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. ///
Результат System.Data.DataTable

NpgsqlConnection() публичный Метод

Initializes a new instance of the NpgsqlConnection class.
public NpgsqlConnection ( ) : System
Результат System

NpgsqlConnection() публичный Метод

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.
Результат System

NpgsqlConnection() публичный Метод

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.
Результат System

Open() публичный Метод

Opens a database connection with the property settings specified by the ConnectionString.
public Open ( ) : void
Результат void