Npgsql 7.0.1
dotnet add package Npgsql --version 7.0.1
NuGet\Install-Package Npgsql -Version 7.0.1
<PackageReference Include="Npgsql" Version="7.0.1" />
paket add Npgsql --version 7.0.1
#r "nuget: Npgsql, 7.0.1"
// Install Npgsql as a Cake Addin
#addin nuget:?package=Npgsql&version=7.0.1
// Install Npgsql as a Cake Tool
#tool nuget:?package=Npgsql&version=7.0.1
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
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETCoreApp 3.1
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Diagnostics.DiagnosticSource (>= 6.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 1.1.1)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Collections.Immutable (>= 7.0.0)
- System.Diagnostics.DiagnosticSource (>= 6.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Json (>= 7.0.0)
- System.Threading.Channels (>= 7.0.0)
-
.NETStandard 2.1
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Collections.Immutable (>= 7.0.0)
- System.Diagnostics.DiagnosticSource (>= 6.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Json (>= 7.0.0)
- System.Threading.Channels (>= 7.0.0)
-
net5.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
NuGet packages (1.2K)
Showing the top 5 NuGet packages that depend on Npgsql:
Package | Downloads |
---|---|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core. |
|
AspNetCore.HealthChecks.NpgSql
HealthChecks.NpgSql is a health check for Postgress Sql. |
|
Npgsql.EntityFrameworkCore.PostgreSQL.Design
PostgreSQL/Npgsql provider for Entity Framework Core. |
|
Hangfire.PostgreSql
PostgreSql storage implementation for Hangfire (background job system for ASP.NET and aspnet core applications). |
|
Npgsql.Json.NET
Json.NET plugin for Npgsql, allowing transparent serialization/deserialization of JSON objects directly to and from the database. |
GitHub repositories (186)
Showing the top 5 popular GitHub repositories that depend on Npgsql:
Repository | Stars |
---|---|
DapperLib/Dapper
Dapper - a simple object mapper for .Net
|
|
dotnet/orleans
Cloud Native application framework for .NET
|
|
nopSolutions/nopCommerce
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
|
|
Radarr/Radarr
A fork of Sonarr to work with movies à la Couchpotato.
|
|
dotnetcore/CAP
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
|
Version | Downloads | Last updated |
---|---|---|
7.0.1 | 668,867 | 12/17/2022 |
7.0.0 | 865,717 | 11/9/2022 |
7.0.0-rc.2 | 39,004 | 10/11/2022 |
7.0.0-rc.1 | 19,277 | 9/16/2022 |
7.0.0-preview.7 | 23,325 | 8/9/2022 |
7.0.0-preview.6 | 25,053 | 7/13/2022 |
7.0.0-preview.5 | 10,711 | 6/19/2022 |
7.0.0-preview.4 | 23,639 | 5/11/2022 |
7.0.0-preview.3 | 27,083 | 4/19/2022 |
7.0.0-preview.2 | 34,296 | 3/16/2022 |
7.0.0-preview.1 | 955,400 | 2/17/2022 |
6.0.8 | 263,693 | 12/17/2022 |
6.0.7 | 3,840,374 | 9/16/2022 |
6.0.6 | 4,042,404 | 8/4/2022 |
6.0.5 | 3,900,958 | 6/19/2022 |
6.0.4 | 5,429,470 | 4/19/2022 |
6.0.3 | 6,531,201 | 1/27/2022 |
6.0.2 | 3,156,659 | 12/20/2021 |
6.0.1 | 3,745,156 | 12/3/2021 |
6.0.0 | 5,435,157 | 11/9/2021 |
6.0.0-rc.2 | 131,119 | 10/14/2021 |
6.0.0-rc.1 | 40,755 | 9/24/2021 |
6.0.0-preview7 | 26,377 | 8/16/2021 |
6.0.0-preview6 | 7,536 | 7/31/2021 |
6.0.0-preview5 | 30,058 | 7/1/2021 |
6.0.0-preview4 | 54,671 | 5/27/2021 |
6.0.0-preview3 | 57,293 | 4/15/2021 |
6.0.0-preview2 | 55,741 | 3/11/2021 |
5.0.15 | 132,802 | 9/16/2022 |
5.0.14 | 175,330 | 6/19/2022 |
5.0.13 | 204,668 | 4/26/2022 |
5.0.12 | 477,713 | 2/1/2022 |
5.0.11 | 1,190,086 | 11/12/2021 |
5.0.10 | 7,147,668 | 9/15/2021 |
5.0.7 | 8,063,624 | 6/13/2021 |
5.0.5 | 3,014,371 | 5/11/2021 |
5.0.4 | 4,147,474 | 3/25/2021 |
5.0.3 | 4,806,635 | 1/26/2021 |
5.0.2 | 3,762,895 | 1/19/2021 |
5.0.1.1 | 2,147,075 | 12/12/2020 |
5.0.0 | 3,494,128 | 11/15/2020 |
4.1.12 | 212,806 | 6/19/2022 |
4.1.11 | 67,715 | 4/26/2022 |
4.1.10 | 455,963 | 11/12/2021 |
4.1.9 | 1,902,349 | 4/6/2021 |
4.1.8 | 2,490,977 | 1/21/2021 |
4.1.7 | 388,475 | 12/12/2020 |
4.1.6 | 823,892 | 11/15/2020 |
4.1.5 | 2,946,955 | 9/28/2020 |
4.1.4 | 3,191,415 | 7/19/2020 |
4.1.3.1 | 15,807,845 | 2/20/2020 |
4.1.3 | 6,650,597 | 1/31/2020 |
4.1.2 | 4,531,619 | 11/14/2019 |
4.1.1 | 2,839,492 | 10/2/2019 |
4.1.0 | 543,699 | 9/26/2019 |
4.0.13 | 8,011 | 6/19/2022 |
4.0.12 | 64,593 | 5/16/2021 |
4.0.11 | 201,606 | 7/19/2020 |
4.0.10 | 4,502,729 | 9/9/2019 |
4.0.9 | 952,304 | 8/14/2019 |
4.0.8 | 775,065 | 7/18/2019 |
4.0.7 | 5,991,451 | 5/21/2019 |
4.0.6 | 2,902,633 | 4/11/2019 |
4.0.5 | 1,145,515 | 3/3/2019 |
4.0.4 | 6,753,249 | 12/6/2018 |
4.0.3 | 5,209,548 | 9/8/2018 |
4.0.2 | 2,835,145 | 7/8/2018 |
4.0.1 | 707,775 | 7/1/2018 |
4.0.0 | 1,602,182 | 5/30/2018 |
4.0.0-rc1 | 70,264 | 5/8/2018 |
4.0.0-preview2 | 67,825 | 4/11/2018 |
4.0.0-preview1 | 15,832 | 3/19/2018 |
3.2.7 | 3,988,559 | 2/27/2018 |
3.2.6 | 4,820,279 | 12/3/2017 |
3.2.5 | 5,137,717 | 7/25/2017 |
3.2.4.1 | 218,944 | 6/22/2017 |
3.2.4 | 23,017 | 6/13/2017 |
3.2.3 | 57,291 | 6/1/2017 |
3.2.2 | 1,493,416 | 3/21/2017 |
3.2.1 | 105,049 | 2/14/2017 |
3.2.0 | 55,923 | 1/27/2017 |
3.1.10 | 73,271 | 2/14/2017 |
3.1.9 | 3,555,103 | 11/20/2016 |
3.1.8 | 317,419 | 9/24/2016 |
3.1.7 | 340,854 | 8/6/2016 |
3.1.6 | 99,557 | 7/12/2016 |
3.1.5 | 231,064 | 6/28/2016 |
3.1.4 | 66,735 | 6/16/2016 |
3.1.3 | 263,322 | 5/30/2016 |
3.1.2 | 86,296 | 5/22/2016 |
3.1.1 | 174,566 | 5/19/2016 |
3.1.0 | 101,086 | 5/16/2016 |
3.0.8 | 34,565 | 6/16/2016 |
3.0.7 | 24,776 | 5/3/2016 |
3.0.6 | 6,166 | 5/1/2016 |
3.0.5 | 212,388 | 1/1/2016 |
3.0.4 | 28,121 | 12/6/2015 |
3.0.3 | 57,030 | 9/27/2015 |
3.0.2 | 20,929 | 9/4/2015 |
3.0.1 | 27,358 | 8/18/2015 |
3.0.0 | 33,478 | 8/7/2015 |
2.2.7 | 343,757 | 9/18/2015 |
2.2.6 | 27,797 | 8/27/2015 |
2.2.5 | 302,120 | 3/11/2015 |
2.2.4.3 | 32,449 | 2/6/2015 |
2.2.4.1 | 12,385 | 2/3/2015 |
2.2.3 | 276,440 | 11/26/2014 |
2.2.2 | 25,997 | 11/1/2014 |
2.2.1 | 44,656 | 9/24/2014 |
2.2.0 | 22,280 | 9/1/2014 |
2.1.3 | 63,979 | 4/9/2014 |
2.1.2 | 13,145 | 3/28/2014 |
2.1.1 | 14,099 | 3/21/2014 |
2.1.0 | 23,129 | 3/19/2014 |
2.0.14.3 | 71,742 | 12/21/2013 |
2.0.12.1 | 64,371 | 12/17/2012 |
2.0.11 | 139,734 | 2/6/2011 |