5

Is it possible to use EF6 with Postgresql database but using database first approach? I found some solution that requires manually writing c# classes based on db structure that is unsatisfactory for me. I would like use it like Sql server, so I choose server and database from list, then I choose tables which I want to use and voilà .

What I did is installing npgsql. I can add this database in Server Explorer tab, but when I want to create ADO.NET Entity Model I can't find this database in list.

4
  • 1
    Does this help github.com/npgsql/npgsql/wiki/… Commented May 15, 2015 at 14:39
  • Fixed typo, technologies highlighting, changed tag to be more specific. Commented May 15, 2015 at 15:21
  • cloud.githubusercontent.com/assets/806698/6134234/… Unfortunately I'm getting error "Your project references the latest version of Entity Framework....". I tried different versions of EF and npgsql, installing npgsql throught nuget as well as manually selecting reference from C:\Program Files (x86)\The Npgsql Development Team\Npgsql\Npgsql-2.2.4.3-net45 and such error displays me every time. At the moment I have installed EF 6.1.3 and npgsql 2.2.4.3 (npgsql.ef 2.2.4.3 also). Commented May 15, 2015 at 22:55
  • My mistake was adding second listening (<system.data> block) to App.config . Now it's fine, thank you Commented May 18, 2015 at 9:36

1 Answer 1

2

Yes this is possible. First, add this extension to Visual Studio 2019 Community Edition (the IDE I used): Npgsql PostgreSQL Integration

Npgsql PostgreSQL Integration

Then, using Nuget package manager, add:

  • EntityFramework6.Npgsql
  • Npgsql

And then you can proceed to add your ado.net entity data model/ database. Tables will be added nicely but I had a challenge with functions and views.

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

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.