2
votes

Steps I did:

  • Install Npgsql EF extension for Visual studio
  • Create a new Project
  • Install Npgsql from nuget
  • Install EntityFramework6.Npgsql from nuget
  • Create connection to postgresql using Server Explorer
  • Create ADO.NET Entity Data Model - EF Designer From DB
  • Compile
  • Create Controller using Entity Framework

The last step give me this error:

There was an error running the selected code generator: 
'Unable to retrieve metadata for 'MyProject.Models.MyClass' 
 Unable to find the requested .Net Framework Data Provider. It may not be installed. 

enter image description here

So I can connect to postgres, create the model from DB, but cant auto generate view from EF.

Further technical details

  • Npgsql version: 3.2.7
  • EntityFramework6.Npgsql 3.1.1
  • PostgreSQL version: 9.4
  • Operating system: Windows 10
  • Visual Studio Community 2017 v15.4

In the webconfig I have this section

  <dependentAssembly>
    <assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.2.7.0" newVersion="3.2.7.0" />
  </dependentAssembly>

Not sure if need add anything else so VS see it as Installed.

1
could you update the title of this question as its very miss leading/confusing in relation to your issue. - Seabizkit
@Seabizkit What you suggest? For me tell what is the problem - Juan Carlos Oropeza

1 Answers

1
votes

add this in config file:

<system.data>
  <DbProviderFactories>
      <remove invariant="Npgsql"/>
      <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF"/>
  </DbProviderFactories>
</system.data>