No MigrationSqlGenerator found when using update-database

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
kasperhj
Posts: 7
Joined: Thu 22 Nov 2012 14:05

No MigrationSqlGenerator found when using update-database

Post by kasperhj » Tue 27 Nov 2012 18:27

I am trying to use EF migrations with MySQL dotconnect (7.2.122.0), but I get the following error when doing an "update-database".

No MigrationSqlGenerator found for provider 'Devart.Data.MySql'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

What should I do?

kasperhj
Posts: 7
Joined: Thu 22 Nov 2012 14:05

Re: No MigrationSqlGenerator found when using update-database

Post by kasperhj » Tue 27 Nov 2012 19:02

I did this

Code: Select all

            SetSqlGenerator(MySqlConnectionInfo.InvariantName,
                                new MySqlEntityMigrationSqlGenerator());
and it solved the problem.

However! I now get another error

Code: Select all

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
It seems like devart is targeting the EF 4.4 and not the 5.0. In my

Code: Select all

c:\Program Files (x86)\Devart\dotConnect\MySQL\Entity\
I only have EF1 and EF4.

Any ideas?

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

Re: No MigrationSqlGenerator found when using update-database

Post by Shalex » Thu 29 Nov 2012 16:05

Please put the following bindingRedirect entry in the *.config file of your application:

Code: Select all

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="EntityFramework"
publicKeyToken="b77a5c561934e089" />
      <bindingRedirect oldVersion="4.4.0.0" newVersion="5.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
  </runtime>

Post Reply