Npgsql 6.0.2 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

Install-Package Npgsql -Version 6.0.2
dotnet add package Npgsql --version 6.0.2
<PackageReference Include="Npgsql" Version="6.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Npgsql --version 6.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Npgsql, 6.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Npgsql as a Cake Addin
#addin nuget:?package=Npgsql&version=6.0.2

// Install Npgsql as a Cake Tool
#tool nuget:?package=Npgsql&version=6.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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

NuGet packages (955)

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 (159)

Showing the top 5 popular GitHub repositories that depend on Npgsql:

Repository Stars
DapperLib/Dapper
Dapper - a simple object mapper for .Net
dotnet/orleans
Orleans is a cross-platform framework for building distributed applications with .NET
nopSolutions/nopCommerce
The most popular open-source eCommerce shopping cart solution based on ASP.NET Core
dotnetcore/CAP
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
ServiceStack/ServiceStack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
Version Downloads Last updated
6.0.2 263,650 12/20/2021
6.0.1 270,756 12/3/2021
6.0.0 462,700 11/9/2021
6.0.0-rc.2 50,303 10/14/2021
6.0.0-rc.1 24,231 9/24/2021
6.0.0-preview7 20,377 8/16/2021
6.0.0-preview6 6,342 7/31/2021
6.0.0-preview5 16,538 7/1/2021
6.0.0-preview4 41,481 5/27/2021
6.0.0-preview3 27,404 4/15/2021
6.0.0-preview2 31,527 3/11/2021
5.0.11 155,661 11/12/2021
5.0.10 2,244,107 9/15/2021
5.0.7 3,838,027 6/13/2021
5.0.5 1,687,518 5/11/2021
5.0.4 2,208,735 3/25/2021
5.0.3 2,767,646 1/26/2021
5.0.2 2,704,118 1/19/2021
5.0.1.1 1,563,469 12/12/2020
5.0.0 2,363,452 11/15/2020
5.0.0-preview1 340,515 10/13/2020
5.0.0-alpha1 37,167 6/17/2020
4.1.10 46,814 11/12/2021
4.1.9 569,440 4/6/2021
4.1.8 1,656,811 1/21/2021
4.1.7 295,975 12/12/2020
4.1.6 537,170 11/15/2020
4.1.5 1,823,316 9/28/2020
4.1.4 2,446,696 7/19/2020
4.1.3.1 11,576,995 2/20/2020
4.1.3 5,364,182 1/31/2020
4.1.2 3,659,893 11/14/2019
4.1.1 2,242,070 10/2/2019
4.1.0 408,830 9/26/2019
4.1.0-preview2 97,732 9/4/2019
4.1.0-preview1 49,069 8/15/2019
4.0.12 36,082 5/16/2021
4.0.11 123,756 7/19/2020
4.0.10 3,246,341 9/9/2019
4.0.9 807,266 8/14/2019
4.0.8 676,414 7/18/2019
4.0.7 5,096,237 5/21/2019
4.0.6 2,480,563 4/11/2019
4.0.5 956,099 3/3/2019
4.0.4 5,719,365 12/6/2018
4.0.3 4,641,319 9/8/2018
4.0.2 2,398,737 7/8/2018
4.0.1 643,387 7/1/2018
4.0.0 1,389,237 5/30/2018
4.0.0-rc1 65,112 5/8/2018
4.0.0-preview2 66,619 4/11/2018
4.0.0-preview1 15,497 3/19/2018
3.2.7 2,762,393 2/27/2018
3.2.6 3,739,873 12/3/2017
3.2.5 4,063,067 7/25/2017
3.2.4.1 199,085 6/22/2017
3.2.4 21,235 6/13/2017
3.2.3 53,537 6/1/2017
3.2.2 1,400,896 3/21/2017
3.2.1 97,226 2/14/2017
3.2.0 51,471 1/27/2017
3.2.0-beta1 3,837 1/11/2017
3.1.10 57,053 2/14/2017
3.1.9 1,992,718 11/20/2016
3.1.8 279,505 9/24/2016
3.1.7 262,141 8/6/2016
3.1.6 88,540 7/12/2016
3.1.5 211,254 6/28/2016
3.1.4 56,013 6/16/2016
3.1.3 253,985 5/30/2016
3.1.2 46,337 5/22/2016
3.1.1 139,837 5/19/2016
3.1.0 75,778 5/16/2016
3.1.0-beta0001 3,888 5/5/2016
3.1.0-alpha6 21,055 12/7/2015
3.1.0-alpha5 7,406 11/18/2015
3.1.0-alpha4 2,760 11/18/2015
3.1.0-alpha3 5,250 10/16/2015
3.1.0-alpha2 2,927 10/16/2015
3.1.0-alpha1 3,873 9/6/2015
3.0.8 21,646 6/16/2016
3.0.7 22,851 5/3/2016
3.0.6 5,554 5/1/2016
3.0.5 191,689 1/1/2016
3.0.4 23,029 12/6/2015
3.0.3 52,713 9/27/2015
3.0.2 18,610 9/4/2015
3.0.1 26,195 8/18/2015
3.0.0 23,635 8/7/2015
3.0.0-rc0002 3,889 7/17/2015
3.0.0-rc0001 2,923 7/12/2015
3.0.0-beta0001 3,332 5/25/2015
2.2.7 282,706 9/18/2015
2.2.6 17,886 8/27/2015
2.2.5 262,666 3/11/2015
2.2.4.3 27,300 2/6/2015
2.2.4.1 10,395 2/3/2015
2.2.3 213,287 11/26/2014
2.2.2 18,709 11/1/2014
2.2.1 41,633 9/24/2014
2.2.0 18,504 9/1/2014
2.2.0-rc2 4,531 8/17/2014
2.2.0-rc1 3,146 8/5/2014
2.2.0-beta1 3,207 7/23/2014
2.1.3 50,791 4/9/2014
2.1.2 11,348 3/28/2014
2.1.1 13,412 3/21/2014
2.1.0 15,159 3/19/2014
2.1.0-rc1 3,565 2/9/2014
2.1.0-beta1 4,496 12/26/2013
2.0.14.3 61,086 12/21/2013
2.0.13-beta1 6,941 7/14/2013
2.0.12.1 55,766 12/17/2012
2.0.11 99,038 2/6/2011