Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>.NET DbContext GeneratorNew to Visual Studio Code? Get it now.
.NET DbContext Generator

.NET DbContext Generator

sachin kore

|
23 installs
| (0) | Free
Generates and maintains DbContext for your .NET models
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

.NET DbContext Generator

Version License

A VS Code extension that automates the creation and configuration of Entity Framework Core DbContext for .NET applications, including SQL Server, MySQL, and SQLite setup.

Demo

Features

  • 🚀 Automatic DbContext Generation: Creates a complete DbContext from your model classes
  • 🛠 Multi-Database Support: Configures for SQL Server, MySQL, or SQLite
  • 🔄 Model Management: Add individual models or regenerate entire DbContext
  • ⚙ Complete Setup: One command to generate DbContext and configure Program.cs
  • 📝 Connection Strings: Automatically creates/updates appsettings.json
  • 🔍 Custom Code Preservation: Maintains your manual code during regeneration

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for ".NET DbContext Generator"
  4. Click Install

Commands

Command Description Shortcut
Generate DbContext Creates DbContext from models -
Configure DbContext Adds DbContext to Program.cs -
Add Model to DbContext Adds single model to existing DbContext -
Regenerate DbContext Updates DbContext while preserving custom code -
Complete DbContext Setup Runs all setup steps automatically Ctrl+Alt+D

Usage

Basic Setup

  1. Create your model classes in the Models folder
  2. Run the Complete DbContext Setup command
  3. Select your database provider (SQL Server, MySQL, or SQLite)
  4. The extension will:
    • Generate AppDbContext.cs
    • Configure Program.cs
    • Update appsettings.json
    • Suggest required NuGet packages

Adding New Models

  1. Create your new model class
  2. Run Add Model to DbContext
  3. Select your model from the list

Configuration Options (optional if you need)

Add these to your VS Code settings.json:

{
  "dotnetDbContextGenerator.modelsDirectory": "Models",
  "dotnetDbContextGenerator.dataDirectory": "Data",
  "dotnetDbContextGenerator.dbContextName": "AppDbContext",
  "dotnetDbContextGenerator.includeOnModelCreating": false,
  "dotnetDbContextGenerator.useLazyLoading": false,
  "dotnetDbContextGenerator.usePluralization": true
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft