Npgsql 9.0.3
Npgsql is the open source .NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using .NET.
Quickstart
Here's a basic code snippet to get you started:
var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";
await using var conn = new NpgsqlConnection(connString);
await conn.OpenAsync();
// Insert some data
await using (var cmd = new NpgsqlCommand("INSERT INTO data (some_field) VALUES (@p)", conn))
{
cmd.Parameters.AddWithValue("p", "Hello world");
await cmd.ExecuteNonQueryAsync();
}
// Retrieve all rows
await using (var cmd = new NpgsqlCommand("SELECT some_field FROM data", conn))
await using (var reader = await cmd.ExecuteReaderAsync())
{
while (await reader.ReadAsync())
Console.WriteLine(reader.GetString(0));
}
Key features
- High-performance PostgreSQL driver. Regularly figures in the top contenders on the TechEmpower Web Framework Benchmarks.
- Full support of most PostgreSQL types, including advanced ones such as arrays, enums, ranges, multiranges, composites, JSON, PostGIS and others.
- Highly-efficient bulk import/export API.
- Failover, load balancing and general multi-host support.
- Great integration with Entity Framework Core via Npgsql.EntityFrameworkCore.PostgreSQL.
For the full documentation, please visit the Npgsql website.
Related packages
- The Entity Framework Core provider that works with this provider is Npgsql.EntityFrameworkCore.PostgreSQL.
- Spatial plugin to work with PostgreSQL PostGIS: Npgsql.NetTopologySuite
- NodaTime plugin to use better date/time types with PostgreSQL: Npgsql.NodaTime
- OpenTelemetry support can be set up with Npgsql.OpenTelemetry
Showing the top 20 packages that depend on Npgsql.
Packages | Downloads |
---|---|
Npgsql.EntityFrameworkCore.PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
|
1 |
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
1 |
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
2 |
.NET 6.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Json (>= 8.0.5)
.NET 8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
Version | Downloads | Last updated |
---|---|---|
9.0.3 | 1 | 3/1/2025 |
9.0.2 | 1 | 1/19/2025 |
9.0.1 | 1 | 1/19/2025 |
8.0.7 | 1 | 3/1/2025 |
8.0.6 | 1 | 1/19/2025 |
8.0.5 | 1 | 11/14/2024 |
8.0.4 | 1 | 11/10/2024 |
8.0.1 | 1 | 11/10/2024 |
7.0.10 | 1 | 4/19/2025 |
7.0.9 | 1 | 1/19/2025 |
7.0.0-preview.6 | 1 | 11/10/2024 |
6.0.13 | 1 | 1/19/2025 |
6.0.7 | 1 | 11/10/2024 |
6.0.2 | 1 | 11/10/2024 |
6.0.0-preview6 | 1 | 11/10/2024 |
6.0.0-preview3 | 1 | 11/10/2024 |
5.0.15 | 1 | 11/10/2024 |
5.0.13 | 1 | 11/10/2024 |
5.0.4 | 1 | 11/10/2024 |
5.0.0 | 1 | 11/13/2024 |
4.1.9 | 1 | 11/10/2024 |
4.1.7 | 1 | 11/10/2024 |
4.1.3 | 1 | 11/10/2024 |
4.1.1 | 1 | 11/10/2024 |
4.0.16 | 1 | 11/10/2024 |
4.0.2 | 1 | 11/10/2024 |
4.0.1 | 1 | 11/10/2024 |
3.2.4 | 1 | 11/10/2024 |
3.1.9 | 1 | 11/10/2024 |
3.1.8 | 1 | 11/10/2024 |
3.1.1 | 1 | 11/10/2024 |
3.0.5 | 1 | 11/10/2024 |
3.0.2 | 1 | 11/10/2024 |
3.0.1 | 1 | 11/10/2024 |
2.2.6 | 1 | 11/10/2024 |