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

Showing the top 20 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

MassTransit/MassTransit

Distributed Application Framework for .NET

btcpayserver/btcpayserver

Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.

dotnetcore/CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern

fullstackhero/dotnet-starter-kit

Production Grade Cloud-Ready .NET 10 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.

danielgerlag/workflow-core

Lightweight workflow engine for .NET Standard

ChilliCream/graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE.

aspnet/Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore

dotnet/aspire

Aspire is the tool for code-first, extensible, observable dev and deploy.

immense/Remotely

A remote control and remote scripting solution, built with .NET 8, Blazor, and SignalR.

dotnetcore/Util

Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。

dotnetcore/WTM

Use WTM to write .netcore app fast !!!

Xabaril/AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package

testcontainers/testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.

cq-panda/Vue.NetCore

(已支持sqlsugar).NetCore、.Net6、Vue2、Vue3、Vite、TypeScript、Element plus+uniapp前后端分离,全自动生成代码;支持移动端(ios/android/h5/微信小程序。http://www.volcore.xyz/

Ombi-app/Ombi

Want a Movie or TV Show on Plex/Emby/Jellyfin? Use Ombi!

borisdj/EFCore.BulkExtensions

Entity Framework EF Core efcore Bulk Batch Extensions with BulkCopy in .Net for Insert Update Delete Read (CRUD), Truncate and SaveChanges operations on SQL Server, PostgreSQL, MySQL, SQLite, Oracle

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