Error-Attempt by method 'X.set_DbConnection(System.Data.Common.DbConnection)' to access method 'Y.get_Settings()' failed

一世执手 提交于 2019-12-17 07:33:24

问题


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."


回答1:


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.




回答2:


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))]  


来源:https://stackoverflow.com/questions/50216643/error-attempt-by-method-x-set-dbconnectionsystem-data-common-dbconnection-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!