Skip to content

badsyntax/vscode-entity-framework

Repository files navigation

Entity Framework Migrations

Build & Publish

A VS Code extension to manage Entity Framework migrations.

Features

treeview

  • List dbContexts for all projects within a solution
  • Add/remove/run/undo migrations

Requirements

Extension Settings

This extension contributes the following settings:

  • entityframework.env: Custom environment vars, for example:

    {
      "entityframework.env": {
        "ASPNETCORE_ENVIRONMENT": "LocalDev",
        "TenantId": "12345"
      }
    }
  • entityframework.commands: Custom commands, for example:

    {
      "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\"",
          "--context",
          "\"$dbContext\""
        ]
      }
    }

Performance

The EF tools execute application code at design time to get information about the project, thus performance can be slow on large projects.

License

See LICENSE.md.