How to integrate PostgreSql with EntityFramework 6.0.2?

c# entity-framework-6 postgresql


I am receiving following error

The 'Instance' member of the Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql, Version=, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see for more information.

Can any one help me

here is my App.Config File

<?xml version="1.0" encoding="utf-8"?>
    <!-- For more information on Entity Framework configuration, visit -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <add name="CacsLocal" connectionString="Server=localhost;Database=Kappa;User Id=postgres; Password=xyz;" providerName="Npgsql" />
    <add name="   CacsCentral" connectionString="Server=localhost;Database=KPT1;User Id=postgres; Password=insane1234;" providerName="Npgsql" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"></provider>
      <add name="Npgsql Data Provider" invariant="Npgsql" description="Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

I have Npgsql2 version Entity Framework 6.0.2

All the packages are installed through Package Manager by following command

Install-Package Npgsql -Pre
Install-Package EntityFramework -Pre


8/24/2015 9:51:47 AM

Accepted Answer

Check out this question: Entity Framework 6 with Npgsql

It has the pointers to get it working. I hope it helps.

5/23/2017 11:53:40 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow