dotConnect for PostgreSQL is a high-performance ORM enabled data provider for PostgreSQL that builds on ADO.NET technology. The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+. It supports a wide range of PostgreSQL-specific features, such as secure SSL and SSH connections, PostgreSQL notifications, PostgreSQL bulk data loading, GEOMETRY, PostgreSQL ARRAY types, and others.a More information at https://www.devart.com/dotconnect/postgresql/ License dotConnect for PostgreSQL is available in several editions https://www.devart.com/dotconnect/postgresql/ordering.html The NuGet package initiates the retrieval of an activation key from the Devart website. This key is required to activate the product for a free trial. Key Features * Easy Connection: Allows your application to work with PostgreSQL. * ASP.NET Core: Supports ASP.NET Core Identity. * Performance: Uses many PostgreSQL-specific performance features & optimizations to ensure the highest performance. * Monitoring: Allows per-component tracing of database events with a free dbMonitor application. * Security: Supports various encryption ciphers, SSL and SSH connections, etc. * Support and updates: Enjoy dedicated support team for prompt issue resolution and regular updates to keep your software running smoothly and securely.
$ dotnet add package Devart.Data.PostgreSqldotConnect for PostgreSQL is a high-performance ORM enabled data provider for PostgreSQL that builds on ADO.NET technology.
The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+.
It supports a wide range of PostgreSQL-specific features, such as secure SSL and SSH connections, PostgreSQL notifications, PostgreSQL bulk data loading, GEOMETRY, PostgreSQL ARRAY types, and others.
More information at dotConnect for PostgreSQL.
The following table show which version of this package to use with which version of frameworks.
| Frameworks | Version support |
|---|---|
| .NET | 10, 9, 8, 7, 6, 5 |
| .NET Core | 3, 2 |
| .NET Framework | 4.8, 4.7, 4.6 |
More information here
For projects, using general ADO.NET functionality of dotConnect for PostgreSQL, you need to install the Devart.Data.PostgreSql package. Execute the following command in the Package Manager Console:
Install-Package Devart.Data.PostgreSql
For projects, using Entity Framework Core 3, 5, 6, 7, 8, 9, 10 with PostgreSQL, install the Devart.Data.PostgreSql.EFCore package.
For projects that require integration with Entity Framework 6.4 (EF6), use the Devart.Data.PostgreSql.EF6 package.
dotConnect for PostgreSQL is available in several editions. See pricing options for ordering.
The NuGet package initiates the retrieval of an activation key from the Devart website. This key is required to activate the product for a free trial.
In this example, a new instance of the PostgreSqlConnection class (part of the Devart.Data.PostgreSql namespace) is created.
using Devart.Data.PostgreSql;
...
PgSqlConnection connection = new PgSqlConnection();
connection.Host = "127.0.0.1";
connection.Port = 5432;
connection.UserId = "postgres";
connection.Password = "postgres";
connection.Database = "test";
connection.Schema = "pg_catalog";This snippet simplifies the PostgreSQL connection setup by directly assigning a connection string to the ConnectionString property of the PostgreSqlConnection object
сonnection.ConnectionString = "UserId=postgres;Password=postgres;Host=127.0.0.1;Port=5432;Database=test;Schema=pg_catalog;";Configuration File Snippet (appsettings.json):
{
"ConnectionStrings": {
"DefaultConnection": "UserId=postgres;Password=postgres;Host=127.0.0.1;Port=5432;Database=test;Schema=pg_catalog;"
}
}Dependency Injection of IConfiguration:
private readonly IConfiguration configuration;
public YourController(IConfiguration config)
{
configuration = config;
}Retrieving a Connection String:
var connectionString = configuration.GetConnectionString("DefaultConnection");
var connection = new PostgreSqlConnection(connectionString);For more information about secure connections using SSL or SSH connections read at our documentation.