12

I created a console app and use EntityFramework 6.2 (for connection with MS SQL), MySql.Data 8.0.11 and MySql.Data.Entity 6.10.7 (for connection with MySQL).

In this application I want to create a job like an SQL job but I don't want to use quertz.net. I have error:

"Attempt by method 'MySql.Data.Entity.EFMySqlCommand.set_DbConnection(System.Data.Common.DbConnection)' to access method 'MySql.Data.MySqlClient.MySqlConnection.get_Settings()' failed."

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Oyama
  • 123
  • 1
  • 6

3 Answers3

49

MySql.Data.Entity 6.10.7 isn't compatible with MySql.Data 8.0.11.

Oracle renamed the package to MySql.Data.EntityFramework for v8.x. You need to uninstall MySql.Data.Entity and install MySql.Data.EntityFramework.

Bradley Grainger
  • 27,458
  • 4
  • 91
  • 108
  • How (or where) can I see these incompatibilites? In my project I have: MySql.Data" version="8.0.13" , MySql.Data.Entity" version="6.10.8" ,MySql.Data.EntityFrameworkCore" version="8.0.13" and MySql.Data.EntityFrameworkCore.Design" version="8.0.13". Need to uninstall too? – Neumann Jan 10 '19 at 15:53
  • @Neumann uninstall "MySql.Data.Entity version=6.10.8". All the MySql.Data packages need to be at the same major version, i.e., 8.0. – Bradley Grainger Jan 10 '19 at 16:40
  • I did the uninstall of MySql.Data.Entity 6.10.8 and seems works best. But now I received an error from providers configuration : didnt find System.Data.Entity.Infrastructure.SqlConnectionFactory. How can I change the ef provider configuration? – Neumann Jan 10 '19 at 16:41
0

They broth thanks, you saved my life. I have lost more than 5 hour trying to figure out what was happening. guys don't forget to put on your database Context.

[DbConfigurationType(typeof(MySql.Data.EntityFramework.MySqlEFConfiguration))]  
Cleptus
  • 3,446
  • 4
  • 28
  • 34
0

I had the same error but with "MySql.Data.EntityFramework" already referenced. My Problem was at the config file. I had to change this: enter image description here

To:

enter image description here

user2029101
  • 116
  • 9