Page 1 of 1

No MigrationSqlGenerator found when using update-database

Posted: Tue 27 Nov 2012 18:27
by kasperhj
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?

Re: No MigrationSqlGenerator found when using update-database

Posted: Tue 27 Nov 2012 19:02
by kasperhj
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?

Re: No MigrationSqlGenerator found when using update-database

Posted: Thu 29 Nov 2012 16:05
by Shalex
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>