To create a Database instance targeting Postgres use
Database
Note: .NET Core / 5 requires the 3rd parameter to be used in the constructor as below.
new Database("host=localhost;user id=postgres;password=password;database=mydb", DatabaseType.PostgreSQL, Npgsql.NpgsqlFactory.Instance);
The following can only be used with NPoco < 5 on .NET Framework
new Database("host=localhost;user id=postgres;password=password;database=mydb", DatabaseType.PostgreSQL);
You need to install npgsql v2.x (from nuget or manually) and add the following to your app.config/web.config.
<system.data> <DbProviderFactories> <add name="Npgsql Data Provider" invariant="Npgsql2" support="FF" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> DbProviderFactories> system.data>
There was an error while loading. Please reload this page.