I succeeded in accessing an existing postgresql dbase by using npgsql directly. I used for this:
In VS 2019
Install the 'PostgreSQL provider for Entity Framework 6' package using NuGet. You do not need to install anything else, Npgsql is included in the package.
Notes:
The package works for the current project only and must be reinstalled with a new project, nothing is installed machine-wide.
Don't mix installing the provider package for your application (the problem to fix here) and installing an extension to Visual Studio referred as 'Visual Studio Integration' (Npgsql.vsix) so that VS can open PostgreSQL databases (e.g. in Server Browser).
To install PostgreSQL provider for EF6:
(You can use the PM command and type Install-Package EntityFramework6.Npgsql -Version 3.2.0 if you prefer)
In case of Factory not found exception
For some reason you may receive an exception when executing your application because .NET can't find the provider factory:
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details. at system.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
In my case, adding this in App.config fixed the problem:
If someone can explain why the section above is missing...
Now you should be able to generate a derived DbContext for PostgreSQL with ADO.NET Entity Data Model wizard.
Details of the installation, for information only
This will copy files into a subdirectory package of your project and reference them:
This will also create entries in the app configuration file App.config: