Table of Contents

5.0 Release Notes

Version 5.0 of the Npgsql Entity Framework Core provider has been released and is available on nuget. This version works with version 5.0 of Entity Framework Core, and brings new Npgsql features in addition to the general EF Core changes.

New Features

Aside from general EF Core features new in 5.0, here is a non-exhaustive list of features added in the Npgsql EF Core provider:

  • Full support for PostgreSQL collations. See the docs for more info.
  • It is now much easier to create indexes for full-text search (#1097, #1253). See the docs for more info.
  • Sequences are now automatically updated after seeding data to avoid duplicate values (#367).
  • The [JsonPropertyName] attribute is now respected when mapping to JSON (#1419).
  • Improved support for PostgreSQL arrays:
    • Mapping List<T> is now fully supported (#395).
    • Mapping arrays of nullable value types (e.g. int?[]) is now supported (#1025).
  • Query translations:
  • Improved null semantics for PostgreSQL-specific operations results in tighter and more efficient SQL (#1142).
  • Better support for NodaTime:
    • It is now possible to map NodaTime Duration to PostgreSQL interval, previously only Period could be mapped (#1567.
    • Some additional arithmetic operation are now translated (#1565).
  • It is now possible to add labels to existing enums (but not remove or modify existing ones). The provider will generate the appropriate migrations (#1182).

The full list of issues for this release is available here.

Breaking changes

Please consult the EF Core 5.0 breaking changes page as well - the below lists only changes specific to the Npgsql provider.

Computed columns must now explicitly be configured as stored (#1336)

Version 3.1 of the provider added support for PostgreSQL generated columns (#939), referred to as computed columns in EF Core. EF Core 5.0 adds support for specifying whether a computed column is virtual (computed when fetched), or stored (persisted on disk and computed when modified). Aligning with most databases, EF Core by default creates virtual computed columns, but these are currently unsupported by PostgreSQL.

As a result, you must explicitly specify on all computed columns that they are stored:

modelBuilder.Entity<Customer>()
    .Property(p => p.FullName)
    .HasComputedColumnSql("...", stored: true);

If you have existing migrations which were created with previous versions of EF Core, the column definitions in those also need to be fixed up with stored: true.

IsCreatedConcurrently defaults to true (#1212)

Previously, when IsCreatedConcurrently was used to configure an index without parameters, the default was false - this has changed to true. Note that indexes are never configured for for concurrent creation unless IsCreatedConcurrently is specified.

Contributors

A big thank you to all the following people who contributed to the 5.0 release!

Milestone 5.0.10

Contributor Assigned issues
@roji 3
@dmitrynovik 1

Milestone 5.0.7

Contributor Assigned issues
@roji 5
@nathan-c 1

Milestone 5.0.6

Contributor Assigned issues
@roji 2
@kakone 1

Milestone 5.0.5.1

Contributor Assigned issues
@fsibilla 1
@roji 1

Milestone 5.0.5

Contributor Assigned issues
@roji 8
@DanielAdolfsson 1

Milestone 5.0.2

Contributor Assigned issues
@roji 6

Milestone 5.0.1

Contributor Assigned issues
@roji 4
@akilin 1

Milestone 5.0.0

Contributor Assigned issues
@roji 50
@artfulsage 1
@cloudlucky 1
@plamen-i 1
@Quogu 1