dotnet ef database code example

Example 1: ef core entity framework sqlite cli

dotnet tool install --global dotnet-ef
dotnet add package Microsoft.EntityFrameworkCore.Design --version 3.1.*
dotnet add package Microsoft.EntityFrameworkCore.Sqlite --version 3.1.*
dotnet ef migrations add InitialCreate
dotnet ef database update

Example 2: dotnet ef add migration context

dotnet ef migrations add InitialCreate --context BlogContext --output-dir Migrations/SqlServerMigrations
dotnet ef migrations add InitialCreate --context SqliteBlogContext --output-dir Migrations/SqliteMigrations

Tags:

C Example