This article is participating in small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

.NET Core EF tools

Every time you use the command line, you can’t remember the parameters, so this tool solves the problem of laziness.

The EF Core allows you to reverse engineer your database and create entities and DbContext classes for the database tables using the Scaffold DbContext or dotnet EF DbContext command.

However, this approach has several drawbacks:

  • You must add design-time components to your project and eventually deploy them into production, increasing the footprint (size) of your application for no reason
  • Specifying which tables to build is not easy, and there is no easy way to just generate entities (POCO) or DbContext classes.

EF Core Power Tools overcomes these problems, and the reverse engineering provided by ordnance has many additional options that are not available on the command line.

Download, go straight to the address.

In the NET Core project, you can use the EF Core Power Tools to visually view the structure of the data model.

Install the EF Core Power Tools extension

Download the latest version on Github: github.com/ErikEJ/EFCo… You can also download according to the above address, installation will not say it, super simple.

Use EF Core Power Tools to generate code.

In c# solution manager, right click on the project name to pop up the EF Core Power Tool menu and select the appropriate option to automatically generate the DBContext and the associated entity class, as well as automatically generate the tag file so that the next time you use it, you know which tables have not generated the code yet.

Supported databases

SQL Server 2012 or later, SQL Azure Database, PostgreSQL, MySQL and SQLite, Firebird, Oracle database and SQL Server database project (.dacpac file)

Most commonly used databases are supported, of course if your database is not present, please download the database driver so that Vs can recognize it.

To use SQL Server/Azure SQL DB, select the SQL Server Provider in the Add dialog box.

To use PostgreSQL, install Npgsql PostgreSQL Visual Studio

To use MySQL, install the MySQL Visual Studio tool

To use Oracle, install Oracle Visual Studio Tools and be sure to use the ODP.NET Managed driver when connecting to the database.