postgresql Visual Studio 实体框架连接到 Postgres 数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11858586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 00:09:36  来源:igfitidea点击:

Visual Studio Entity Framework connect to Postgres database

postgresqlentity-framework-4.1database-connection

提问by robertpas

I want to connect to a Postgres database using EntityFramework. Is that possible?

我想使用 EntityFramework 连接到 Postgres 数据库。那可能吗?

I select:

我选择:

Add>>New Item>>ADO.Net Entity Data model>>Generate from database>>New connection

添加>>新建项目>>ADO.Net实体数据模型>>从数据库生成>>新建连接

But I'm stuck there. I need to generate classes for the tables in the database.

但我被困在那里。我需要为数据库中的表生成类。

How can I do this?

我怎样才能做到这一点?

采纳答案by Eggi

The best solution to use PostgreSQL in combination with Entity Framework is the dotConnect provider from Devart.

将 PostgreSQL 与实体框架结合使用的最佳解决方案是来自 Devart 的 dotConnect 提供程序。

You can find the PostgreSQL provider here:

您可以在此处找到 PostgreSQL 提供程序:

http://www.devart.com/dotconnect/postgresql

http://www.devart.com/dotconnect/postgresql

回答by Craig Ringer

The following question:

以下问题:

Entity framework PostgreSQL

实体框架 PostgreSQL

is extremely similar to yours, and covers the same ground. You will see references to npgsql there, and to Devart.

与你的极为相似,并且涵盖相同的领域。您将在那里看到对 npgsql 和 Devart 的引用。