Unable to run Update-Databe

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
brunosilva
Posts: 3
Joined: Fri 22 May 2015 19:05

Unable to run Update-Databe

Post by brunosilva » Tue 26 May 2015 15:24

I've updated my dotConnect version to the last one and now I am getting this error:

update-database -verbose
Using StartUp project 'SIVI.PortalCliente'.
Using NuGet project 'SIVI.PortalCliente'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.TypeLoadException: Inheritance security rules violated by type: 'Devart.Common.Entity.Migrations.DbConnectionInfoBase'. Derived types must either match the security accessibility of the base type or be less accessible.
at SIVI.PortalCliente.Migrations.Configuration..ctor()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Data.Entity.Migrations.Utilities.MigrationsConfigurationFinder.FindMigrationsConfiguration(Type contextType, String configurationTypeName, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Inheritance security rules violated by type: 'Devart.Common.Entity.Migrations.DbConnectionInfoBase'. Derived types must either match the security accessibility of the base type or be less accessible.

I'm using the last version of dotConnect and EF 6.1.0.

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

Re: Unable to run Update-Databe

Post by Shalex » Wed 27 May 2015 07:14

brunosilva wrote:I've updated my dotConnect version to the last one and now I am getting this error:
update-database -verbose
[...] 'Devart.Common.Entity.Migrations.DbConnectionInfoBase'. Derived types must either match the security accessibility of the base type or be less accessible. [...]
1. Your current version of dotConnect for PostgreSQL is 7.3.407, isn't it? You can check this via Tools > PostgreSQL > About.

2. Please remove references to the Devart.* assemblies from your project and readd them again from:
C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.dll
C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.PostgreSql.dll
C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF6\Devart.Data.PostgreSql.Entity.dll

3. Check your *.config. It should include the following entries:

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>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=7.3.407.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
  <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=7.3.407.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
</configuration>
Replace 7.3.407 here with your current version of dotConnect for PostgreSQL. Please note that the revision number of provider in the entityFramework section is *.6 but it should be *.0 in DbProviderFactories.

Post Reply