Skip to content

HuaweiCloudDeveloper/gaussdb-dotnet

This branch is 2 commits ahead of, 5 commits behind npgsql/npgsql:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1245c03 · Mar 14, 2025
Nov 20, 2024
Nov 10, 2024
Mar 4, 2025
Nov 10, 2024
Mar 14, 2025
Mar 4, 2025
Mar 4, 2025
Sep 26, 2021
Jun 17, 2020
Mar 11, 2018
Nov 18, 2024
Nov 19, 2024
Apr 15, 2024
Sep 25, 2023
Mar 7, 2023
Dec 3, 2013
Jun 19, 2023
Mar 15, 2023
Mar 4, 2025
Sep 24, 2019

Repository files navigation

Npgsql - the .NET data provider for PostgreSQL

stable next patch daily builds (vnext) build gitter

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:

using Npgsql;

var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";

var dataSourceBuilder = new NpgsqlDataSourceBuilder(connString);
var dataSource = dataSourceBuilder.Build();

var conn = await dataSource.OpenConnectionAsync();

// 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 at https://www.npgsql.org.

About

The .NET data provider for GaussDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%