question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use EF6 Entity Data Model wizard

See original GitHub issue

Hi,

With Visual Studio 2017, I cannot use the AdoNet Entity Data Model wizard, each time , the wizard answer “provider not found

I installed : Npgsql PostGesSql Integration vsix (3.2.6) (then reboot the computer) Entity Framework 6.2.0 and EntityFramework.fr 6.2.0 Npgsql (3.2.6) EntityFramework6.Npgsql (3.1.1) (then reboot the computer)

Next I create a new VS solution, and ask for new Ado.net Entity Data Model (Ef Designer from database / new connection / postgres database) The wizard is displayed, I fill it with right values , and test the connection, it is OK

then saving the config, the wizard give an error “.NetFramework is not found, Perhaps it is not installed” (but in french, so my translation is a rough one).

My App.config file (The system.data was added by myself, without it, the result is the same)

`<?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> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> </startup> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" /> </providers> </entityFramework> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.2.6.0" newVersion="3.2.6.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> </dependentAssembly> </assemblyBinding> </runtime>

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

</configuration>`

I use Windows 7 Postgres is 9.2.2 version (not local but from a microsoft server)

remarks: The wizard crash without any error message the selecting any checkbox The wizard give the same error then directly clicking the OK button without filling any field

Can you help me to solve my problem ?

Best regards

Luc

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JaneChen1000commented, May 12, 2020

With Visual Studio 2017, .NET Framework 4.6.1, PostgreSQL 9.3.5

We installed :

  1. Npgsql PostGesSql Integration vsix (3.2.7) From window explorer, install Npgsql.VSIX 3.2.7 (Npgsql-3.2.7.msi) Download from https://github.com/npgsql/Npgsql/releases?after=v4.0.0-rc1 In VS2017, open Tool=>Extension and Update window, ensure that “Npgsql PostgreSQL Integeration” vesion is 3.2.7" and checkbox “Automatically update this extension” is NOT checked. otherwise, after reboot and extension will update to latest version such as “4.3.1.1 (as today 5/11/2020)” (then reboot the computer)

  2. Npgsql (3.2.7) In VS2017, View=> Other Windows =>Package Manager Console Install-Package Npgsql –Version 3.2.7

  3. EntityFramework6.Npgsql (3.1.1) In VS2017, View=> Other Windows =>Package Manager Console Install-Package EntityFramework6.Npgsql –Version 3.1.1 (then reboot the computer)

the reason we install EntityFramework6.Npgsql 3.1.1 is because its dependency: https://www.nuget.org/packages/EntityFramework6.Npgsql/3.1.1 EntityFramework (>=6.0.0) Npgsql (>=3.1.0)

if install EntityFramework6.Npgsql 3.2.0, its dependency: EntityFramework (>=6.2.0) Npgsql (>=4.0.2)

we have to insure that all Npgsql versions are matched. 4) reference: https://www.npgsql.org/ef6/index.html To use Entity Framework with Npgsql, define a class that inherits from DbConfiguration in the same assembly as your class inheriting DbContext. Ensure that you configure provider services, a provider factory, a default connection factory as shown below:

using Npgsql;
using System.Data.Entity;

class NpgSqlConfiguration : DbConfiguration
{
    public NpgSqlConfiguration()
    {
        var name = "Npgsql";

        SetProviderFactory(providerInvariantName: name,
        providerFactory: NpgsqlFactory.Instance);

        SetProviderServices(providerInvariantName: name,
        provider: NpgsqlServices.Instance);

        SetDefaultConnectionFactory(connectionFactory: new NpgsqlConnectionFactory());
    }
}

Or reference following link https://schneide.blog/2017/09/26/using-postgresql-with-entity-framework/ To add <system.data> section into App.Config:

<system.data>
    <DbProviderFactories>
      <add name="Npgsql Data Provider"
           invariant="Npgsql"
           description="Data Provider for PostgreSQL"
           type="Npgsql.NpgsqlFactory, Npgsql"
           support="FF"/>
     </DbProviderFactories>
  </system.data>

either way will work.

we are able to build EntityFramework data model through Postgre Data provider in VS2017 and get database user table to show on list box.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Create Entity Data Model - using MySql and EF6
NET 6.9\Assemblies\v4.5\MySql.Data.Entity.EF6.dll. I was then able to complete the ADO.Net wizard, with the .edmx models.
Read more >
Can't find ado.net entity data model missing visual studio ...
You can right-click on the Models folder and select Add New Item->Data->Ado.Net Entity Data Model. 88211-capture.png. If the answer is helpful, ...
Read more >
Using Entity Data Model Wizard - Documentation
Database Objects Are Not Included in the Model. ADO.NET Entity Framework can't work with user-defined types and PL/SQL types that cannot be used...
Read more >
Create Entity Data Model
Entity Data Model is a model that describes entities and the relationships between them. Let's create a simple EDM for the School database...
Read more >
Entity Framework ADO.net Entity Data Model not working
Hello ,. I observed that when I wand to add a new Model created from database is not working. Can you see in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found