I have spent many hours trying to use PostgreSQL with ASP.NET Boilerplate Core 2.x + Module Zero (which looks awesome!).
I added
Npgsql.EntityFrameworkCore.PostgreSQL
&Npgsql.EntityFrameworkCore.PostgreSQL.Design
dependencies tomyApp.EntityFrameworkCore
.I also changed the connection string and I use
builder.UseNpgsql
instead ofbuilder.UseSqlServer
inmyappDbContextConfigurer.cs
.
As a new project, I started with Npgsql v2.0.0
. But after a few problems, I found that this release has some issues. So I returned to the 1.1.1
release.
I'm pretty sure this part works fine. The next step is to delete all existing migrations and reload them:
Add-Migration "Initial_Migrations"
Add-Migration "AbpZero_Initial"
When I do the first one, I get an error:
Method 'Clone' in type 'Microsoft.EntityFrameworkCore.Infrastructure.Internal.NpgsqlOptionsExtension' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=1.1.1.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.
I found a beginning of the solution here (6th post): https://forum.aspnetboilerplate.com/viewtopic.php?t=5304&p=13013
The post seems a little bit outdated and I don't know where to implement NpgsqlMigrationSqlGenerator
(I mean, in which project).
Thank you for reading this post, any help will be appreciated.