MetadataException

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Oleg Mikhaylov
Posts: 5
Joined: Mon 28 Jan 2013 14:06

MetadataException

Post by Oleg Mikhaylov » Thu 14 Feb 2013 14:13

There was topic about similar issue at http://forums.devart.com/viewtopic.php?f=30&t=25699, in that case error was caused by configuration. But in my case similar error appears with correct configuration, I think after recent EF6 NuGet package update (MS updated it today).

I checked configuration, it looks ok, assembly versions have 6 at the end like in that discussion:

Code: Select all

<?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" />
  </configSections>
  
  <connectionStrings>
    <add name="TestEntitiesConnectionString" connectionString="metadata=TestModel.csdl|TestModel.ssdl|TestModel.msl;provider=Devart.Data.PostgreSql;provider connection string="User Id=postgres;Password=123456;Host=localhost;Database=test;Persist Security Info=True;Schema=public"" providerName="System.Data.EntityClient" />
  </connectionStrings>

  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.PostgreSql"/>
      <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=6.4.164.0, Culture=neutral, PublicKeyToken=09af7300eec23701"/>
    </DbProviderFactories>
  </system.data>

  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=6.4.164.6, Culture=neutral, PublicKeyToken=09af7300eec23701">
        <migrationSqlGenerator type="Devart.Data.PostgreSql.Entity.Migrations.PgSqlEntityMigrationSqlGenerator, Devart.Data.PostgreSql.Entity, Version=6.4.164.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      </provider>
    </providers>
  </entityFramework>  
  
</configuration>
Exception is following:
Schema specified is not valid. Errors:
TestModel.ssdl(2,2) : error 0152: The 'Instance' member of the Entity Framework provider type 'Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=6.4.164.6, Culture=neutral, PublicKeyToken=09af7300eec23701' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must extend from this class and the 'Instance' member must return the Singleton instance of the provider.
Could you please make quick test to ensure is it provider or my issue?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: MetadataException

Post by Shalex » Fri 15 Feb 2013 16:47

We cannot reproduce the problem with dotConnect for PostgreSQL v 6.4.179 and EntityFramework.dll v 6.0.20214.0. Please do the following:
1. Set a break point in the code, navigate to Debug > Windows > Modules, and make sure that Devart.Data.PostgreSql.Entity.dll with the revision number 6 (e.g.: 6.4.164.6) is loaded in the process of your application.
2. Upgrade to the 6.4.179 version of dotConnect for PostgreSQL.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: MetadataException

Post by Shalex » Mon 18 Feb 2013 10:00

The possible reason of the problem in your environment.
You have installed dotConnect for PostgreSQL v 6.4.164 and configured your application for using it. Then upgraded the provider to the 6.4.179 version but the configuration (in *.config) was not updated. If this is not the case, make sure that only one Devart.Data.PostgreSql.Entity.dll assembly (of the 6.4.164.6 version) is loaded in the process of your application (assuming that dotConnect for PostgreSQL v 6.4.164 is installed on your workstation).

Oleg Mikhaylov
Posts: 5
Joined: Mon 28 Jan 2013 14:06

Re: MetadataException

Post by Oleg Mikhaylov » Tue 19 Feb 2013 13:44

Thanks!

It really was an error with old version stucked in GAC.

Post Reply