A VS Code extension to manage Entity Framework migrations.
- List migrations by
DbContext
- Add / Remove / Run / Undo migrations
- Show migration applied status
- Export
DbContext
as SQL script - View
DbContext
information - Scaffold
DbContext
& entity types
- dotnet sdk
- efcore tools
- Microsoft.EntityFrameworkCore.Design must be installed in one of the projects
This extension contributes the following settings:
-
entityframework.commands
: Custom commandsExample
{ "entityframework.commands": { "addMigration": [ "dotnet", "ef", "migrations", "add", "\"$migrationName\"", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--context", "\"$dbContext\"" ], "removeMigration": [ "dotnet", "ef", "migrations", "remove", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--context", "\"$dbContext\"" ], "runMigration": [ "dotnet", "ef", "database", "update", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--context", "\"$dbContext\"", "\"$migrationId\"" ], "generateScript": [ "dotnet", "ef", "dbcontext", "script", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--context", "\"$dbContext\"" ], "listDbContexts": [ "dotnet", "ef", "dbcontext", "list", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--no-color", "--json" ], "listMigrations": [ "dotnet", "ef", "migrations", "list", "--context", "\"$context\"", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--no-color", "--json" ], "dbContextInfo": [ "dotnet", "ef", "dbcontext", "info", "--context", "\"$dbContext\"", "--project", "\"$project\"", "--startup-project", "\"$project\"", "--no-color", "--json" ], "scaffold": [ "dotnet", "ef", "dbcontext", "scaffold", "\"$connectionString\"", "\"$provider\"", "--output-dir", "\"$outputDir\"", "--context", "\"$context\"", "--project", "\"$project\"", "--context-dir", "\"$contextDir\"", "--namespace", "\"$namespace\"", "--no-color", "--json" ] } }
-
entityframework.env
: Custom environment variablesExample
{ "entityframework.env": { "ASPNETCORE_ENVIRONMENT": "LocalDev", "TenantId": "12345" } }
The EF tools execute application code at design time to get information about the project, thus performance on large projects can be slow.
See LICENSE.md.