How to configure the DbProviderFactory for NPoco?

579 Views Asked by At

I'm switching from PetaPoco to NPoco but I have a connection problem with my PostgreSQL instance using Npgsql.

  • Configuration is in web.config of my Web project
  • NPoco/Npgsql are in a DAL assembly.
  • ConnectiongString works properly

The problem seems to come from the DbProviderFactory using NPoco (because it works with PetaPoco).

<add name="Npgsql Data Provider"
           invariant="Npgsql"
           support="FF"
           description=".Net Framework Data Provider for Postgresql Server"
           type="Npgsql.NpgsqlFactory, Npgsql, Version=3.1.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
  • Using "invariant="Npgsql", I get this error message on database instantiation : "Unable to find the requested .Net Framework Data Provider. It may not be installed."

  • Using "invariant="Npgsql2" (as indicated in NPoco's Wiki, even if I use NPoco v3), I get this error message at any query (but after DB instantiation) : "Format of the initialization string does not conform to specification starting at index 0"

I tried to change the "type" to indicate the assembly where Npgsql can be found but it didn't solve anything.

How can I change my configuration to make it works ?

0

There are 0 best solutions below