3

I want to use Entity Framework 6 to connect to PostgreSql database using Visual Studio 2015 (Entreprise).

So i have used nuget to install:

  • entityFramework
  • npgsql
  • npgsql.entityFramework

Then i have modified the app.config like below:

<system.data>
    <DbProviderFactories>
      <clear />
      <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.5, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
    </DbProviderFactories>
  </system.data>
<entityFramework>
    <providers>
      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
    </providers>
   <defaultConnectionFactory type="Npgsql.NpgsqlConnectionFactory, Npgsql" />
  </entityFramework>

After that, i have tried to generate the edmx file of PostgreSql database:

  1. Right click on the project in visual studio 2015
  2. Add new item
  3. Select "ADO.Net entity data model" object under "data" tab and "Entity Data Model Wizard" is there
    1. Select "EF designer from database" and click next
    2. Click new connection button Add i get the window "Choose data source" enter image description here

As you can see in the picture, there's no data source for PostgreSql. Is there something to set up with visual studio 2015?

1
  • What happens when you select <other> Commented Nov 17, 2015 at 20:58

2 Answers 2

2

The thing is i should setup Visual Studio 2015 the first time to support npgsql. The full setup is here http://www.npgsql.org/doc/ddex.html May be the link could help someone else

Sign up to request clarification or add additional context in comments.

Comments

0

For me didn't help to add such strings in app.config (even relaunch VS many times), but helped to recreate project after installed "Npgsql PostgreSQL Integration Visual Studio", the same lines were added to app.config automatically.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.