Use EF Core Power Tools Reverse Engineering tutorial

Ready to work

Install the following packages in NuGet

  • Install Microsoft.EntityFrameworkCore. In VS 2019, the .NET Framwork version is 4.7.2, and the latest version of Microsoft.EntityFrameworkCore cannot be installed successfully. Therefore, the currently used version of Microsoft.EntityFrameworkCore is 3.1.8;
  • Install Pomelo.EntityFrameworkCore.MySql, the version of Pomelo.EntityFrameworkCore.MySql selected in VS 2019 is 3.2.4;
  • Install Dapper;
  • Install Dapper.Rainbow.MySql, the current version is 0.10.1;

EF-Core Power Tools installation

VS menu [Extensions] --> [Manage Extensions] --> Search for [EF Core Power Tool] to install;

MySql ODBC data source configuration

  1. Install the mysql-connector-odbc driver;
  1. Add ODBC data source How to add data source to odbc in mysql under windows-Baidu experience (baidu.com) ;

The configuration is complete, as shown in the figure below

Note: This step may not be needed after installing MySql for VS ;

Reverse Engineering tutorial

Reference URL:

Reverse Engineering · ErikEJ/EFCorePowerTools Wiki · GitHub

Download and install mysql for vs;

Select the project, click the right mouse button, and click [EF Core Tools] --> [Reverse Engineering] in the menu;

In the pop-up dialog box, click the [Add] button

In the pop-up dialog box, click the [Change] button;

Select "Data Source" as "MySql";

Set connection properties;

Test the connection;

Click the [OK] button;

Click the [OK] button;

Select the table name of the entity class to be reflected in the database;

Configure the EF Core model;