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.

Showing the top 20 packages that depend on Npgsql.

Packages Downloads
Npgsql.EntityFrameworkCore.PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
3,965
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
92
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
882
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
1,636
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
6,298
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
10,908
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
15,098
Npgsql.EntityFrameworkCore.PostgreSQL.Design
Npgsql.EntityFrameworkCore.PostgreSQL.Design
3,955
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
75
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
76
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
79
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
84
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
85
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
94
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
96
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
97
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
102
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
105
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
113

Version Downloads Last updated
9.0.3 5 02/27/2025
9.0.2 10 12/13/2024
9.0.1 8 11/26/2024
9.0.0 8 12/14/2024
8.0.7 5 02/27/2025
8.0.6 6 11/26/2024
8.0.5 12 10/14/2024
8.0.4 11 09/11/2024
8.0.3 17 05/22/2024
8.0.2 21 02/16/2024
8.0.1 15 12/05/2023
8.0.0 16 11/21/2023
8.0.0-rc.2 19 10/13/2023
8.0.0-preview.4 27 05/31/2023
8.0.0-preview.3 46 05/09/2023
8.0.0-preview.2 36 04/04/2023
8.0.0-preview.1 29 04/04/2023
7.0.9 7 11/26/2024
7.0.8 8 09/12/2024
7.0.7 11 05/22/2024
7.0.6 14 09/25/2023
7.0.4 29 06/07/2023
7.0.2 34 04/04/2023
7.0.1 27 01/15/2023
7.0.0 1,588 11/15/2022
7.0.0-rc.2 104 12/01/2022
7.0.0-rc.1 67 09/22/2022
7.0.0-preview.7 34 09/04/2022
7.0.0-preview.6 89 07/30/2022
7.0.0-preview.5 85 09/08/2022
7.0.0-preview.4 42 09/07/2022
7.0.0-preview.3 26 09/08/2022
7.0.0-preview.2 73 09/02/2022
7.0.0-preview.1 19 09/07/2022
6.0.13 9 11/26/2024
6.0.12 12 09/11/2024
6.0.11 12 05/22/2024
6.0.10 13 09/27/2023
6.0.9 30 04/04/2023
6.0.8 6,296 01/15/2023
6.0.7 14,442 09/21/2022
6.0.6 74 09/03/2022
6.0.5 34 08/21/2022
6.0.4 64 08/25/2022
6.0.3 173 06/28/2022
6.0.2 42 09/02/2022
6.0.1 71 08/21/2022
6.0.0 49 09/03/2022
6.0.0-rc.2 92 08/25/2022
6.0.0-rc.1 44 08/23/2022
6.0.0-preview7 39 09/05/2022
6.0.0-preview6 63 08/24/2022
6.0.0-preview5 42 08/04/2022
6.0.0-preview4 53 08/24/2022
6.0.0-preview3 18 08/22/2022
6.0.0-preview2 62 08/25/2022
5.0.18 14 05/22/2024
5.0.17 14 09/23/2023
5.0.16 45 04/04/2023
5.0.15 43 09/22/2022
5.0.14 80 08/24/2022
5.0.13 21 09/08/2022
5.0.12 53 09/02/2022
5.0.11 26 09/02/2022
5.0.10 10,816 06/27/2022
5.0.7 24 09/09/2022
5.0.5 59 09/07/2022
5.0.4 65 08/23/2022
5.0.3 53 09/03/2022
5.0.2 27 09/09/2022
5.0.1.1 60 09/08/2022
5.0.0 82 08/02/2022
4.1.14 14 05/22/2024
4.1.13 12 05/15/2024
4.1.12 33 08/23/2022
4.1.11 34 09/09/2022
4.1.10 45 08/27/2022
4.1.9 39 09/10/2022
4.1.8 83 08/22/2022
4.1.7 35 09/02/2022
4.1.6 26 09/07/2022
4.1.5 62 09/08/2022
4.1.4 45 09/03/2022
4.1.3.1 20 09/07/2022
4.1.3 93 09/09/2022
4.1.2 46 09/09/2022
4.1.1 80 09/03/2022
4.1.0 59 08/26/2022
4.0.17 10 06/10/2024
4.0.16 13 05/22/2024
4.0.14 14 05/22/2024
4.0.13 45 08/23/2022
4.0.12 53 09/09/2022
4.0.11 39 09/02/2022
4.0.10 75 09/09/2022
4.0.9 37 09/02/2022
4.0.8 26 08/21/2022
4.0.7 55 09/03/2022
4.0.6 33 09/02/2022
4.0.5 38 08/22/2022
4.0.4 30 09/02/2022
4.0.3 79 09/07/2022
4.0.2 78 09/09/2022
4.0.1 92 09/02/2022
4.0.0 87 08/20/2022
4.0.0-rc1 23 09/07/2022
4.0.0-preview2 37 08/24/2022
4.0.0-preview1 36 09/02/2022
3.2.7 35 06/29/2022
3.2.6 38 07/02/2022
3.2.5 61 09/07/2022
3.2.4.1 22 07/31/2022
3.2.4 37 08/22/2022
3.2.3 49 07/05/2022
3.2.2 26 08/24/2022
3.2.1 39 09/08/2022
3.2.0 97 09/02/2022
3.1.10 75 09/07/2022
3.1.9 3,955 06/27/2022
3.1.8 23 09/08/2022
3.1.7 41 08/15/2022
3.1.6 29 09/04/2022
3.1.5 33 09/06/2022
3.1.4 19 09/08/2022
3.1.3 52 07/31/2022
3.1.2 83 09/08/2022
3.1.1 90 08/23/2022
3.1.0 86 08/23/2022
3.0.8 37 09/08/2022
3.0.7 68 08/24/2022
3.0.6 92 07/31/2022
3.0.5 25 09/03/2022
3.0.4 34 07/11/2022
3.0.3 44 08/21/2022
3.0.2 66 09/07/2022
3.0.1 39 08/26/2022
3.0.0 27 08/22/2022
2.2.7 76 09/02/2022
2.2.6 23 07/01/2022
2.2.5 24 08/27/2022
2.2.4.3 33 08/24/2022
2.2.4.1 34 09/09/2022
2.2.3 42 09/08/2022
2.2.2 47 09/09/2022
2.2.1 24 08/21/2022
2.2.0 43 08/22/2022
2.1.3 34 09/08/2022
2.1.2 69 07/13/2022
2.1.1 50 08/24/2022
2.1.0 112 09/10/2022
2.0.14.3 59 09/02/2022
2.0.12.1 33 08/24/2022
2.0.11 61 08/26/2022