2.2 Release Notes
Version 2.2.0 of the Npgsql Entity Framework Core provider has been released and is available on nuget. This version works with version 2.2.0 of Entity Framework Core, and contains some new Npgsql features as well.
This release was result of hard work by @roji, @austindrenski, @yohdeadfall and @khellang.
New Features
Aside from general EF Core features new in 2.2.0, the Npgsql EF Core provider contains the following major new features:
PostgreSQL 11 covering indexes
PostgreSQL 11 introduced covering indexes feature, which allow you to include "non-key" columns in your indexes. This allows you to perform index-only scans and can provide a significant performance boost. Support has been added in (#697):
protected override void OnConfiguring(DbContextOptionsBuilder builder)
=> modelBuilder.Entity<Blog>()
.ForNpgsqlHasIndex(b => b.Id)
.ForNpgsqlInclude(b => b.Name);
This will create an index for searching on Id
, but containing also the column Name
, so that reading the latter will not involve accessing the table. See the documentation for more details.
Thanks to @khellang for contributing this!
PostgreSQL user-defined ranges
The provider already supported PostgreSQL range types, but prior to 2.2 that support was limited to the built-in range types which come with PostgreSQL. #329 extends that support to range types which you define:
protected override void OnConfiguring(DbContextOptionsBuilder builder)
=> builder.UseNpgsql("...", b => b.MapRange<float>("floatrange"));
protected override void OnModelCreating(ModelBuilder builder)
=> builder.ForNpgsqlHasRange("floatrange", "real");
This will make the provider create a PostgreSQL range called floatrange
, over the PostgreSQL type real
. Any property with type NpgsqlRange<float>
will be seamlessly mapped to it.
See the documentation for more details.
Seeding for Npgsql-specific types
When using some Npgsql-specific types, it wasn't possible to seed values for those types. With EF Core support for seeding any type, #667 allows seeding values for network, bit and range types (more are coming).
PostgreSQL index operator classes
PostgreSQL allows you to specify operator classes on your indexes, to allow tweaking how the index should work. #481 adds support for managing these. See the documentation for more details.
Thanks to @khellang for contributing this!
Other features
- Various issues with enum and range types were fixed, including upper/lower case, quoting and schema management.
- Many new SQL translations were added, so more of your LINQ expressions can run in the database. We'll be working on our documentation to make these more discoverable.
The full list of issues for this release is available here.
Contributors
Thank you very much to the following people who have contributed to the individual 2.2.x. releases.
Milestone 2.2.6
Contributor | Assigned issues |
---|---|
@roji | 5 |
Milestone 2.2.4
Contributor | Assigned issues |
---|---|
@roji | 3 |
@austindrenski | 1 |
Milestone 2.2.0
Contributor | Assigned issues |
---|---|
@austindrenski | 15 |
@roji | 8 |