Npgsql Entity Framework Core provider for PostgreSQL

Npgsql.EntityFrameworkCore.PostgreSQL is the open source EF Core provider for PostgreSQL. It allows you to interact with PostgreSQL via the most widely-used .NET O/RM from Microsoft, and use familiar LINQ syntax to express queries. It's built on top of Npgsql.

The provider looks and feels just like any other Entity Framework Core provider. Here's a quick sample to get you started:

await using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();

// Insert a Blog
ctx.Blogs.Add(new() { Name = "FooBlog" });
await ctx.SaveChangesAsync();

// Query all blogs who's name starts with F
var fBlogs = await ctx.Blogs.Where(b => b.Name.StartsWith("F")).ToListAsync();

public class BlogContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.UseNpgsql(@"Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase");
}

public class Blog
{
    public int Id { get; set; }
    public string Name { get; set; }
}

Aside from providing general EF Core support for PostgreSQL, the provider also exposes some PostgreSQL-specific capabilities, allowing you to query JSON, array or range columns, as well as many other advanced features. For more information, see the the Npgsql site. For information about EF Core in general, see the EF Core website.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 

NuGet packages (1.8K)

Showing the top 5 NuGet packages that depend on Npgsql.EntityFrameworkCore.PostgreSQL:

Package Downloads
Npgsql.EntityFrameworkCore.PostgreSQL.Design

PostgreSQL/Npgsql provider for Entity Framework Core.

Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite

NetTopologySuite PostGIS spatial support plugin for PostgreSQL/Npgsql Entity Framework Core provider.

Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime

NodaTime support plugin for PostgreSQL/Npgsql Entity Framework Core provider.

EFCore.BulkExtensions.PostgreSql

EntityFramework .Net EFCore EF Core Bulk Batch Extensions for Insert Update Delete Read (CRUD) operations on PostgreSQL

EaCloud.EntityFrameworkCore.PostgreSql

EaCloud PostgreSql 数据库组件,封装基于 Npgsql.EntityFrameworkCore.PostgreSQL 的数据访问功能的实现。

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Npgsql.EntityFrameworkCore.PostgreSQL:

Repository Stars
dotnet/aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

bitwarden/server

Bitwarden infrastructure/backend (API, database, Docker, etc).

abpframework/abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.

dotnet/eShop

A reference .NET application implementing an eCommerce site

Version Downloads Last Updated
11.0.0-preview.1 2,723 2/10/2026
10.0.0 4,979,755 11/22/2025
10.0.0-rc.2 153,803 10/16/2025
10.0.0-rc.1 65,796 9/10/2025
10.0.0-preview.7 16,640 8/17/2025
10.0.0-preview.5 34,121 6/11/2025
10.0.0-preview.3 12,076 4/12/2025
10.0.0-preview.2 6,228 3/24/2025
10.0.0-preview.1 9,026 3/1/2025
9.0.4 26,446,518 3/1/2025
9.0.3 8,496,186 1/17/2025
9.0.2 6,156,273 12/7/2024
9.0.1 2,519,361 11/19/2024
9.0.0-rc.2 122,236 10/13/2024
9.0.0-rc.1 67,249 9/13/2024
9.0.0-preview.7 18,327 9/1/2024
8.0.11 21,389,995 11/18/2024
8.0.10 8,220,722 10/17/2024
8.0.8 5,445,604 9/27/2024