snippetbashTip
dotnet ef — Perform design-time development tasks for Entity Framework Core. More information: <https://learn.mi
Viewed 0 times
commanddesigndevelopmentperformclidotnet eftimetasks
Problem
How to use the
dotnet ef command: Perform design-time development tasks for Entity Framework Core. More information: <https://learn.microsoft.com/ef/core/cli/dotnet>.Solution
dotnet ef — Perform design-time development tasks for Entity Framework Core. More information: <https://learn.microsoft.com/ef/core/cli/dotnet>.Update the database to a specified migration:
dotnet ef database update {{migration}}Drop the database:
dotnet ef database dropList available
DbContext types:dotnet ef dbcontext listGenerate code for a
DbContext and entity types for a database:dotnet ef dbcontext scaffold {{connection_string}} {{provider}}Add a new migration:
dotnet ef migrations add {{name}}Remove the last migration, rolling back the code changes that were done for the latest migration:
dotnet ef migrations removeList available migrations:
dotnet ef migrations listGenerate an SQL script from migrations range:
dotnet ef migrations script {{from_migration}} {{to_migration}}Code Snippets
Update the database to a specified migration
dotnet ef database update {{migration}}Drop the database
dotnet ef database dropList available `DbContext` types
dotnet ef dbcontext listGenerate code for a `DbContext` and entity types for a database
dotnet ef dbcontext scaffold {{connection_string}} {{provider}}Add a new migration
dotnet ef migrations add {{name}}Context
tldr-pages: common/dotnet ef
Revisions (0)
No revisions yet.