Entity Framework 6.1.3 support for PostgreSQL

Entity Framework 6.1.3 support for PostgreSQL

Postby kaushalparik27 » Thu 05 Jan 2017 13:34

Hello Experts,
I am trying to connect to a PostgreSQL database with Entity Framework 6.1.3. I used trial version of dotConnect Profesisonal edition for PostgreSQL. Problem is, it only works till I use EF 5.0, when I try to use EF having version > 5.0 (till 6.1.3 which is latest), I face this error:

Schema specified is not valid. Errors:
Model1.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'Devart.Data.PostgreSql'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.


Any help greatly appreciated. Thanks!
kaushalparik27
 
Posts: 1
Joined: Thu 05 Jan 2017 13:26

Re: Entity Framework 6.1.3 support for PostgreSQL

Postby Shalex » Thu 05 Jan 2017 19:27

You should add registration of EF6 provider in your app.config manually and rebuild (!) the project before running the EDM Wizard:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity.EF6, Version=7.7.804.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.PostgreSql" />
      <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL"
       type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=7.7.804.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>

Replace 7.7.804.0 here with your current version of dotConnect for PostgreSQL.

We recommend you to use Entity Developer (the Devart Entity Model item, *.edml) instead of EDM Designer (the ADO.NET Entity Data Model item, *.edmx) because it is adjusted for working with PostgreSQL and has an advanced functionality: http://www.devart.com/entitydeveloper/ed-vs-edm.html. Additionally, Entity Developer adds registration of EF6 provider in app.config automatically and offers designer (Database First / Model First) for EF Core.
Shalex
Devart Team
 
Posts: 7709
Joined: Thu 14 Aug 2008 12:44


Return to Entity Framework support