Sto cercando di creare un piccolo POC per il mio capo circa l'ibrido di npgsql 12 e EF6, creato un nuovo progetto sul Visual Studio creato un database di esempio creato le classi corrispondenti e il DbContext eppure, ogni volta che provo e utilizzare ef per accedere al database che ricevo l'errore folowing:Utilizzo di npgsql 12 e ef 6 insieme: qualcuno ci è riuscito?
The 'Instance' member of the Entity Framework provider type 'Npgsql.NpgsqlFactory, Npgsql, Version=2.0.12.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
so che dovrebbe essere sostenuto per un bel po 'di tempo http://fxjr.blogspot.co.il/2013/06/initial-ef-6-support-added-to-npgsql.html
però io non riesco a farlo funzionare, mia App.C il file onfig è simile al seguente:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http:// go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!--<section name="entityFramework" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.12.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />-->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="Npgsql.NpgsqlFactory, Npgsql">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider"
invariant="Npgsql"
description="Data Provider for PostgreSQL"
type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="CoolestPGSoft"
connectionString="Server=127.0.0.1;Port=5432;Database=CoolestPGSoft;User Id=postgres;Password=********;"
providerName="Npgsql" />
</connectionStrings>
</configuration>
qualsiasi aiuto sarebbe apprezzato!
Mi ci è voluto un po 'per capirlo da solo - ho dovuto andare nella console del gestore pacchetti e usare "Install-Package npgsql -Pre", anche di d che su entity-framework, grazie per aver confermato che avrei dovuto farlo solo per npgsql. –
Utilizzo di NpgSql dal file zip qui (2.0.13.91) Infatti non lancia l'eccezione DbProvider ma genera molte altre strane eccezioni nelle query. EF6 e NpgSql 2.0.14.3 Sono ora disponibili su nuget senza usare -pre. Ma ricado ancora alla stessa eccezione di cui sopra. Entrambe le versioni stabile EF e NpgSql sono state rilasciate e deve esserci una soluzione! –