npgsql 2.1.3 and EF 6: Could not determine storage version; a valid storage connection or a version hint is required

c# entity-framework npgsql postgresql


I'm adding the support to EF 6 to my sql generator for PostgreSQL: PostgreSQL Migration Generator

I have created a test project to try it but when I create a new connection return new NpgsqlConnection();, it throw this exception to me:

An exception of type 'System.NotSupportedException' occurred in EntityFramework.dll but was not handled in user code

Additional information: Unable to determine the provider name for provider factory of type 'Npgsql.NpgsqlFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.

Follow the instruction found in the Npgsql official site, I use this 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" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework"></provider>
    <defaultConnectionFactory type="Npgsql.NpgsqlConnectionFactory, Npgsql" />
      <remove invariant="Npgsql" />
      <add name="Npgsql Data Provider" invariant="Npgsql" support="FF" description=".Net Framework Data Provider for Postgresql" type="Npgsql.NpgsqlFactory, Npgsql" />

I don't understand why this exception is fired up. I have tried a lot of configuration but anyone works.

7/14/2014 10:32:51 AM

Popular Answer

Solution Explorer

  1. Right click over file .edmx
  2. Open with..
  3. Editor XML
  4. Change ProviderManifestToken="XXXX" with 2008
8/8/2014 2:26:13 PM

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