Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Entity FrameworkNew to Visual Studio Code? Get it now.

Entity Framework

Richard Willis

|
700 installs
| (0) | Free
Manage Entity Framework migrations in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Entity Framework

Build & Publish

A VS Code extension to manage Entity Framework migrations.

Entity Framework Migrations

Requirements

  • dotnet sdk
  • efcore tools
  • Microsoft.EntityFrameworkCore.Design must be installed in one of the projects

Features

  • List migrations by DbContext
  • Add / Remove / Run / Undo migrations
  • Show migration applied status
  • Reset (Squash) Migrations
  • Export DbContext as SQL script
  • View DbContext information
  • Scaffold DbContext & entity types
  • Generate ER Diagram (Requires EF Core 7+)

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.

Entity Framework ER Diagram

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\"",
          "--startup-project",
          "\"$project\"",
          "--context",
          "\"$dbContext\""
        ],
        "listDbContexts": [
          "dotnet",
          "ef",
          "dbcontext",
          "list",
          "--project",
          "\"$project\"",
          "--startup-project",
          "\"$project\""
        ],
        "listMigrations": [
          "dotnet",
          "ef",
          "migrations",
          "list",
          "--context",
          "\"$context\"",
          "--project",
          "\"$project\"",
          "--startup-project",
          "\"$project\""
        ],
        "dbContextInfo": [
          "dotnet",
          "ef",
          "dbcontext",
          "info",
          "--context",
          "\"$dbContext\"",
          "--project",
          "\"$project\"",
          "--startup-project",
          "\"$project\""
        ],
        "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

    Example
    {
      "entityframework.erDiagram": {
        "ignoreTables": [".*Tracking$"]
      }
    }
    
  • 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

  • 👉 Submit a bug report
  • 👉 Submit a feature request

License

See LICENSE.md.

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft