Hassan Agmir Hassan Agmir

Installing and Using the Entity Framework Core CLI Tool (dotnet-ef)

Hassan Agmir

The command:

dotnet tool install --global dotnet-ef

installs 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

dotnet ef migrations add InitialCreate

Create a database migration

dotnet ef database update

Apply migrations to the database

dotnet ef migrations list

List existing migrations

dotnet ef dbcontext scaffold

Generate models from an existing database

Example

If your .NET Web API uses Entity Framework Core:

dotnet ef migrations add CreateUsersTable
dotnet ef database update

This creates a migration and updates your database schema.

Subscribe to my Newsletters

Stay updated with the latest programming tips, tricks, and IT insights! Join my community to receive exclusive content on coding best practices.

© Copyright 2025 by Hassan Agmir . Built with ❤ by Me