我試圖將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註冊那樣的東西,所以我發佈了它以防萬一缺少任何東西 –