As for existing SQL Server

Install EF first:

dotnet tool install --global dotnet-ef

Prepare a clean .NET project:

anduin@aiursoft.com MINGW64 ~/Desktop  
$ mkdir Temp  

anduin@aiursoft.com MINGW64 ~/Desktop  
$ cd Temp/  

anduin@aiursoft.com MINGW64 ~/Desktop/Temp  
$ dotnet new console  
Getting ready...  
The template "Console Application" was created successfully.  

Processing post-creation actions...  
Running 'dotnet restore' on C:\\Users\\xuef\\Desktop\\Temp\\Temp.csproj...  
	Determining projects to restore...  
	Restored C:\\Users\\xuef\\Desktop\\Temp\\Temp.csproj (in 61 ms).  
Restore succeeded.  


anduin@aiursoft.com MINGW64 ~/Desktop/Temp  
$ ls  
obj/  Program.cs  Temp.csproj

Before further steps, install some required dependencies:

anduin@aiursoft.com MINGW64 ~/Desktop/Temp  
$ dotnet add package Microsoft.EntityFrameworkCore.SqlServer
$ dotnet add package Microsoft.EntityFrameworkCore.Design

And try to execute the following command under your project folder to reverse the database:

$ dotnet ef dbcontext scaffold "Server=....." Microsoft.EntityFrameworkCore.SqlServer -o Models

And fill the string Server=..... with your database connection string. Make sure that you can connect to this database successfully.

anduin@aiursoft.com MINGW64 ~/Desktop/Temp  
$ dotnet ef dbcontext scaffold "Data Source=aaaaaaaaa.database.windows.net;Initial Catalog=bbbbbbb;User ID=mydatabase;Password=cccc  
ccccc" Microsoft.EntityFrameworkCore.SqlServer -o Models --table EmergencyPatchAttempts  
Build started...  
Build succeeded.  
To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection  
string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing conne  
ction strings, see http://go.microsoft.com/fwlink/?LinkId=723263.

And EF will try to build models from the database.

generated

Note: Once you have created the model, you must use the Migration commands whenever you change the model to keep the database up to date with the model.

Only want to reverse one table or one view?

Yeah, that command is supported to operate only one table or one view.

Pass the parameter: -t TableNameOrViewName

Example:

$ dotnet ef dbcontext scaffold "Server=....." Microsoft.EntityFrameworkCore.SqlServer -o Models -t TableOrViewName

As for existing MySQL

Steps are similar.

You can follow this article: https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-scaffold-example.html.

DO USE .NET 5.0! Or you will fail! I wasted here for several hours!

mkdir MyApp5.0
cd MyApp5.0
dotnet new console -f net5.0
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package MySql.EntityFrameworkCore

After reversing, upgrade your project:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

    <ItemGroup>
    <PackageReference Include="MySql.EntityFrameworkCore" Version="6.0.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.12" />
  </ItemGroup>

</Project>