Installing and Using the Entity Framework Core CLI Tool (dotnet-ef)
The command:
dotnet tool install --global dotnet-efinstalls the Entity Framework Core (EF Core) command-line tool globally on your computer.
What is dotnet-ef used for?
It allows you to manage Entity Framework Core databases directly from your terminal.
Command | Purpose |
|---|---|
| Create a database migration |
| Apply migrations to the database |
| List existing migrations |
| Generate models from an existing database |
Example
If your .NET Web API uses Entity Framework Core:
dotnet ef migrations add CreateUsersTable
dotnet ef database updateThis creates a migration and updates your database schema.