我试图将Postgres数据库连接到EDMX设计器。Npgsql实体框架 - 无法看到ADO.net实体数据模型的Postgres提供程序
我已经安装了EntityFrameowrk6.npgsql金块模块如下所述:http://www.npgsql.org/ef6/index.html(数据库中已经有他的uuid-OSSP扩展)
然后我安装了扩展包,如下所述:http://www.npgsql.org/doc/ddex.html
最后,我已经将npgsql模块更新到v3.2.1,以便与集成文档中建议的扩展版本相匹配。
我可以使用visual studio的服务器浏览器连接到我的数据库。
这样做后,我已经添加了一个ado.net实体数据模型到我的项目中,但他只提供给我的提供者是Microsoft sql的。没有Postgres在望!
我正在运行Visual Studio Community 2017,它完全是最新版本,并且唯一安装的其他扩展程序是AnkhSVN。这是一个C#项目,目前为.net 4.5.1配置(但我非常高兴并愿意更改目标框架以使其正常工作)。
我的项目中唯一的Nuget包是上面描述的他们的依赖。
很多谷歌搜索导致只是各种教程告诉我做基本上面的,或者人们添加元素到app.config(我试过,失败和恢复),npgsql文档明确指出你不应该'不需要做。
任何帮助非常感谢!
编辑:这是我的App.Config,因为它目前的立场。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, EntityFramework6.Npgsql" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.1.0" newVersion="3.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
有两层支持 - 通过服务器浏览器提供“基本”VS支持,通过EDM向导提供EF支持。对于前者(基本的VSIX功能),您不需要修改任何app.config(或除安装扩展程序之外的任何其他内容)。但是,EF支持确实需要将Npgsql EF提供程序注册到*应用程序的* app.config(而不是Visual Studio的)中。你可以尝试添加Npgsql的EF提供程序并发布结果吗?如果它不起作用,请发布app.config。 –
好的,App.Config已经拥有了像npgsql注册那样的东西,所以我发布了它以防万一缺少任何东西 –