EF Core
Install CLI
dotnet tool install --global dotnet-ef
# Add to project, needed by the CLI tool
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.<DatabaseProvider>
CLI Commands
Add a migration
Apply migrations
Remove last migration
List migrations
Data Seeding
- Use
HasData
inOnModelCreating
-
Create migration, changes are only applied if a migration is created.
Resources
Last update:
August 11, 2023
Created: June 3, 2023
Created: June 3, 2023