Home >Database >Mysql Tutorial >Why Does \'EFMySqlCommand.set_DbConnection\' Fail to Access \'MySqlConnection.get_Settings()\'?

Why Does \'EFMySqlCommand.set_DbConnection\' Fail to Access \'MySqlConnection.get_Settings()\'?

Susan Sarandon
Susan SarandonOriginal
2024-11-03 07:44:29941browse

Why Does

Compatibility Error: EFMySqlCommand Accessing MySqlConnection Settings

In a console application utilizing EntityFramework 6.2 for MS SQL and MySql.Data for MySQL connection, an error occurs during the creation of a custom job:

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

Resolution:

This error stems from a compatibility issue between MySql.Data.Entity 6.10.7 and MySql.Data 8.0.11. Oracle has renamed the package to MySql.Data.EntityFramework for v8.x and beyond.

To resolve this, follow these steps:

  1. Uninstall MySql.Data.Entity.
  2. Install MySql.Data.EntityFramework.

Once the correct package is installed, the application should function without the error.

The above is the detailed content of Why Does \'EFMySqlCommand.set_DbConnection\' Fail to Access \'MySqlConnection.get_Settings()\'?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn