1
我在嘗試將EntityFramwork
與Postgres
和Npgsql
進行整合。使用Npgsql生成EntityFramework時出錯
已安裝的軟件包是:
<package id="Npgsql" version="2.2.7" targetFramework="net45" />
<package id="Npgsql.EF6" version="2.0.12-pre4" targetFramework="net45" />
<package id="Npgsql.EntityFramework" version="2.2.7" targetFramework="net45" />
我有類似的問題與soluctions的想法與MySql
但與postgres
我不知道如何解決它。
Web.config文件:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=7.1.26.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Npgsql" />
<add name="Npgsql Data Provider" invariant="Npgsql" description="Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>