Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Entity Framework Core provider for PostgreSQL

License

NotificationsYou must be signed in to change notification settings

npgsql/efcore.pg

Repository files navigation

stablenext patchdaily builds (vnext)buildgitter

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 ofNpgsql.

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

awaitusingvarctx=newBlogContext();awaitctx.Database.EnsureDeletedAsync();awaitctx.Database.EnsureCreatedAsync();// Insert a Blogctx.Blogs.Add(new(){Name="FooBlog"});awaitctx.SaveChangesAsync();// Query all blogs who's name starts with FvarfBlogs=awaitctx.Blogs.Where(b=>b.Name.StartsWith("F")).ToListAsync();publicclassBlogContext:DbContext{publicDbSet<Blog>Blogs{get;set;}protectedoverridevoidOnConfiguring(DbContextOptionsBuilderoptionsBuilder)=>optionsBuilder.UseNpgsql(@"Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase");}publicclassBlog{publicintId{get;set;}publicstringName{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 thethe Npgsql site. For information about EF Core in general, see theEF Core website.

Related packages

Packages

 
 
 

Contributors64


[8]ページ先頭

©2009-2025 Movatter.jp