Skip to content

badsyntax/vscode-entity-framework

Repository files navigation

Entity Framework Migrations

Build & Publish

A VS Code extension to manage Entity Framework migrations.

Entity Framework Migrations

Features

  • List migrations by DbContext
  • Add/remove/run/undo migrations
  • Show migration applied status
  • Export DbContext as SQL script
  • View DbContext information

Requirements

Extension Settings

This extension contributes the following settings:

  • entityframework.commands: Custom commands

    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\""
        ],
        "listDbContexts": [
          "dotnet",
          "ef",
          "dbcontext",
          "list",
          "--project",
          "\"$project\"",
          "--no-color",
          "--json"
        ],
        "listMigrations": [
          "dotnet",
          "ef",
          "migrations",
          "list",
          "--context",
          "\"$context\"",
          "--project",
          "\"$project\"",
          "--no-color",
          "--json"
        ],
        "dbContextInfo": [
          "dotnet",
          "ef",
          "dbcontext",
          "info",
          "--context",
          "\"$dbContext\"",
          "--project",
          "\"$project\"",
          "--no-color",
          "--json"
        ]
      }
    }
  • entityframework.env: Custom environment variables

    Example
    {
      "entityframework.env": {
        "ASPNETCORE_ENVIRONMENT": "LocalDev",
        "TenantId": "12345"
      }
    }

Performance

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

Support

License

See LICENSE.md.