Manage Entity Framework migrations in VS Code.
MIT License
A VS Code extension to manage Entity Framework migrations.
DbContext
DbContext
as SQL scriptDbContext
informationDbContext
& entity typesSet the project
and startupProject
configuration for the workspace by clicking on the Configure
icon in the tree view:
This extension contributes the following settings:
entityframework.project
: Target Project
{
"entityframework.project": "src/Infrastructure"
}
entityframework.startupProject
: Startup Project
{
"entityframework.startupProject": "ExampleAPI"
}
entityframework.commands
: Custom commands
{
"entityframework.commands": {
"addMigration": [
"dotnet",
"ef",
"migrations",
"add",
"\"$migrationName\"",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\"",
"--context",
"\"$dbContext\""
],
"removeMigration": [
"dotnet",
"ef",
"migrations",
"remove",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\"",
"--context",
"\"$dbContext\""
],
"runMigration": [
"dotnet",
"ef",
"database",
"update",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\"",
"--context",
"\"$dbContext\"",
"\"$migrationId\""
],
"generateScript": [
"dotnet",
"ef",
"dbcontext",
"script",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\"",
"--context",
"\"$dbContext\""
],
"listDbContexts": [
"dotnet",
"ef",
"dbcontext",
"list",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\""
],
"listMigrations": [
"dotnet",
"ef",
"migrations",
"list",
"--context",
"\"$context\"",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\""
],
"dbContextInfo": [
"dotnet",
"ef",
"dbcontext",
"info",
"--context",
"\"$dbContext\"",
"--project",
"\"$project\"",
"--startup-project",
"\"$startupProject\""
],
"scaffold": [
"dotnet",
"ef",
"dbcontext",
"scaffold",
"\"$connectionString\"",
"\"$provider\"",
"--output-dir",
"\"$outputDir\"",
"--context",
"\"$context\"",
"--project",
"\"$project\"",
"--context-dir",
"\"$contextDir\"",
"--namespace",
"\"$namespace\""
],
"generateERD": [
"dotnet",
"ef",
"dbcontext",
"scaffold",
"\"$connectionString\"",
"\"$provider\"",
"--context",
"\"$context\"",
"--project",
"\"$project\"",
"--output-dir",
"\"$outputDir\"",
"--use-database-names"
]
}
}
entityframework.erDiagram.ignoreTables
: A list of tables to ignore from the ER Diagram
{
"entityframework.erDiagram": {
"ignoreTables": [".*Tracking$"]
}
}
entityframework.env
: Custom environment variables
{
"entityframework.env": {
"ASPNETCORE_ENVIRONMENT": "LocalDev",
"TenantId": "12345"
}
}
When generating an ER diagram, a Mermaid
.t4
template will be installed into the project. You can ignore this file (by adding it to .gitignore
), or add it to source control. The template file is used to generate the ER Diagram, feel free to customise it. If you delete it, it will be regenerated next time you generate an ER Diagram.
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.