3.0 Release Notes
Version 3.0.0 of the Npgsql Entity Framework Core provider has been released and is available on nuget. This version works with version 3.0.0 of Entity Framework Core, and bring new Npgsql features in addition to the general EF Core changes.
Use these versions with care and do not deploy to production without thorough testing. Read the breaking changes section below.
The full list of issues for this release is available here.
Aside from general EF Core features new in 3.0.0, the Npgsql EF Core provider contains the following major new features:
- It is now possible to map POCOs to JSON columns and query them, see the docs for more info (#981)
- PostgreSQL identity columns are now the default - see breaking changes below) (#804)
- Sequence options can now be managed on identity columns (#819)
- Support has been added for the upcoming PostgreSQL 12 generated columns feature (#939)
- A plugin is now available to automatically make all your tables and columns be snake_case! See EFCore.NamingConventions.
- Index sort options (ascending/descending, null sort order...) can now be specified (#326)
- Indexes can now be created concurrently (#967)
- Views are now reverse-engineered (#878)
- Array value converters help mapping with PostgreSQL arrays (e.g. map enum arrays to integer arrays) (#1031).
Default value generation strategy is now IDENTITY
This is a major change, and upgrading to 3.0 with an existing database will cause a non-trivial schema migration to be generated. Read the following carefully.
The default value generation strategy has changed from the older SERIAL columns to the newer IDENTITY columns, introduced in PostgreSQL 10.
When producing a migration with 3.0, the Npgsql provider will attempt to automatically generate SQL to alter your tables and convert serial columns to identity ones. This is a sensitive, one-time migration operation that should be done with care, and carefully tested before deployment to production.
If you wish to opt out of using IDENTITY columns and continue using SERIAL columns, set the following on your model:
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.UseSerialColumns();
If you are using a PostgreSQL version older than 10, setting the compatibility mode is a better way to switch the default back to SERIAL columns:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseNpgsql("...", o => o.SetPostgresVersion(9, 6));
More information is available in the page about generated properties.
Thank you very much to the following people who have contributed to the individual 3.0.x. releases.