sst*_*sin 5 postgresql entity-framework
经过几个小时的搜索,我有点失望。任何人都可以确认(或不)使用 EF 数据库优先方法(我的意思是,使用 VS EDMX degigner)可以与现有的 Postgres SQL 数据库一起使用吗?
一些要求:
干杯
这个问题出现在大多数谷歌搜索 EF Database First with Postgres 中,接受的答案指向 CODE first 而非 DATABASE 的演练,所以我将添加一个指向这个答案的指针,这使我获得了解决它的大部分方法:
Visual Studio 2015 中的向导中缺少 PostgreSQL 数据提供程序
本质上,postgres 有一个 Visual Studio 扩展(只需在 Postgres 的扩展和更新中搜索),但我还必须修改 app.config 中的实体框架节点,因为它是在我安装扩展之前添加的,如下所示:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" />
</providers>
</entityFramework>
Run Code Online (Sandbox Code Playgroud)
这将 npgsql 添加为数据提供者,在我这样做之后,数据提供者作为选项出现在 EF 数据库第一个向导中。
| 归档时间: |
|
| 查看次数: |
11888 次 |
| 最近记录: |