How to make the Entity Framework tool "ADO" in Visual Studio2017. NET Entity Data Model "supports MySQL data sources

Source: Internet
Author: User
Tags mysql for visual studio

Familiarity with the Entity Framework should be not unfamiliar to the film, he is the ADO Entity Data Model Wizard: You can automatically generate a model class for a database table, or create a model file for code first.

However, this Model wizard only displays Microsoft's own SQL Server data source by default, and if you want to use a MySQL data source, you have to do some configuration.

Your own solution is as follows:

1, import the entity Framework 6.1.3.

    • This is the premise of the ADO Entity Data Model option. If there is no Entity Framework package, the ADO Entity Data Model option is not in the new item menu.
    • 6.1.3 version is important, otherwise the model may be converted with an error:System.Data.StrongTypingException:The value for column ' IsPrimaryKey ' in table ' Tabledetails ' is DBNull. ---> System.InvalidCastException:Specified cast is not valid.

2. Install MySQL connector/net 6.9.9 and MySQL for Visual Studio 1.2.7.

Mysql for Visual Studio 1.2.7 is April 10, 2017 release, which supports the Visual Studio 2017 editor.

Always remember to install the entity Framework support:

You must remember to install the entity Framework support for Vs 2017:

3, restart Visual studio2017, and add the ADO Entity Data Model again.

Finally there is the MySQL database option.

4, add the latest version mysql.web.6.9.9, mysql.data.6.9.9, mysql.data.enity.6.9.9 package.

If you do not add the NuGet package as above, you will see the following error:

5, connect the MySQL database, select the corresponding table and view information to create the object class.

Summarize

A few simple steps can solve a lot of problems, if you do not know that will delay a lot of time.

How to make the Entity Framework tool "ADO" in Visual Studio2017. NET Entity Data Model "supports MySQL data sources

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.