This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23002|Reply: 0

[Solved] VS2017 +EF6 Connect to MYSQL database to generate entities

[Copy link]
Posted on 7/4/2019 12:25:58 PM | | | |
This post was last edited by QWERTYU on 2019-7-5 10:37

1. Installation (preparation):
VS2017
Mysql Service + Navicat (Mysql Client)
mysql-for-visualstudio-1.2.7.msi (Download according to your own needs:The hyperlink login is visible.
mysql-connector-net-6.10.8 (download and install it yourself according to the version used in your project:The hyperlink login is visible.
2. Use (official use):



Using the EF Designer:



If you find that MySQL is not available at the moment, you have not installed it yetmysql-for-visualstudio and mysql-connector-net, please install them first as described in the first step


After installation, continue to operate

Install Mysql.Data.Entity using Nuget (it must be the same version of mysql-connector-net that you installed in the first step, otherwise there may be a crash in subsequent operations)




Then you can press itStep to generate the corresponding entity in MYSQL.



At this point, there is no suspense anymore.



At this point, the whole thing is done.

Frequently asked questions:
Question 1.
The connection string is not available, add a new connection, test the connection is successful, but after sure, it will give the prompt "The given keyword is not in the dictionary" as shown in the image below



Solution:

1. Make sure that the MySQL version used in VS (NuGet can get the corresponding version) is the same as the Mysql Connector version installed on the current computer.

2. Close VS (be sure to close all VS windows), find the file DefaultView.SEView in the system disk and delete it.

The usual path is: Users\AppData\Microsoft\VisualStudio\xx\ServerExplorer


Question 2.

There is a crashOr the problem as shown in the figure below is due to the inconsistency between the MySql.Data.Entity.EF6 version referenced in the project and the installed mysql-connector-net version




Solution:

The version of MySql.Data.Entity.EF6 referenced in the project is inconsistent with the version of mysql-connector-net installed. Just change it to consistent


Others:

If you want to delete an existing connection string,



Close VS (be sure to close all VS windows),

Find the file DefaultView.SEView in the system disk and delete it.

The usual path is: Users\AppData\Microsoft\VisualStudio\xx\ServerExplorer














Previous:Google Chrome will support the Premium Ads standard globally starting July 9
Next:ubuntu vsftpd 530 Login incorrect root cause and solution
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com