1

Closed

Unable to find the requested .Net Data Provider.

description

I am using a PostgreSql Database and I ma getting the following Error:
Unable to find the requested .Net Framework Data Provider. It may not be installed.

Npgsql.dll is referenced in the project. SqlServer Provider works.
My Context method looks like this:
private IDbContext Context() {
return new DbContext().ConnectionStringName("ApplicationCS", new  PostgreSqlProvider());
}

It fails at ConnectionString.cs line 11
DbProviderFactory adoNetProvider = System.Data.Common.DbProviderFactories.GetFactory(providerName);

RW Bradley
Closed Apr 12, 2014 at 7:24 AM by kindblad

comments

kindblad wrote Apr 12, 2014 at 7:23 AM

This was solved through e-mail communication however the solution was:
It's not enough to just reference the postgresql provider, you also
need to set it up as a ADO.NET provider. This can be done either
through an installer (cant remember if npgsql has one) or in the
.config file. For the config file would be something like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql" support="FF"
description=".Net Framework Data Provider for Postgresql Server"
type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.11.94,
Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
</DbProviderFactories>
</system.data>

So change the version and publickeytoken to the correct one for your
npgsql version.

wrote Apr 12, 2014 at 7:24 AM

wrote Apr 12, 2014 at 7:24 AM