Lukas
Lukas

Reputation: 613

Postgresql with Entity Framework 6 (database first approach)

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.

Upvotes: 5

Views: 7790

Answers (1)

Ntsikelelo Ndleleni
Ntsikelelo Ndleleni

Reputation: 41

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.

Upvotes: 2

Related Questions