Skip to content

Repository files navigation

Npgsql - the .NET data provider for PostgreSQL

stablenext patchdaily builds (vnext)buildgitter

What is Npgsql?

Npgsql is the open source .NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using .NET.

For the full documentation, please visit the Npgsql website. For the Entity Framework Core provider that works with this provider, see Npgsql.EntityFrameworkCore.PostgreSQL.

Quickstart

Here's a basic code snippet to get you started:

varconnString="Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";awaitusingvarconn=newNpgsqlConnection(connString);awaitconn.OpenAsync();// Insert some dataawaitusing(varcmd=newNpgsqlCommand("INSERT INTO data (some_field) VALUES (@p)",conn)){cmd.Parameters.AddWithValue("p","Hello world");awaitcmd.ExecuteNonQueryAsync();}// Retrieve all rowsawaitusing(varcmd=newNpgsqlCommand("SELECT some_field FROM data",conn))awaitusing(varreader=awaitcmd.ExecuteReaderAsync()){while(awaitreader.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 at https://www.npgsql.org.

About

Npgsql is the .NET data provider for PostgreSQL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages