scaffolding

Automate EF Core scaffolding to generate DbContext and entity models from an existing database.

14.8k|3.4k|Updated Jan 23, 2014
One-click install
npx skills add https://github.com/dotnet/efcore --skill scaffolding-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scaffolding
Source: https://github.com/dotnet/efcore/tree/main/.agents/skills/scaffolding
Command: npx skills add https://github.com/dotnet/efcore --skill scaffolding-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Scaffolding EF Core from an existing database is complex and error prone; this skill provides a structured approach to reverse-engineering a DbContext and entity model.

Core Features & Use Cases

  • Deterministic pipeline to generate DbContext and entity models from an existing database.
  • Aligns with EF Core scaffolding components to ensure tooling compatibility and template-driven output.
  • Use Case: onboarding legacy databases to EF Core with consistent naming and structure.

Quick Start

Follow the scaffolding process to generate a DbContext and entity classes from a sample database.

Frequently Asked Questions about scaffolding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate EF Core DbContext and entity models from an existing database schema?

To generate EF Core DbContext and entity models from an existing database schema, use a reverse-engineering scaffolding pipeline that implements IDatabaseModelFactory, IScaffoldingModelFactory, and IModelCodeGenerator for consistent, template-driven output.

What is the best way to onboard a legacy database to EF Core with consistent naming?

The best way to onboard a legacy database to EF Core with consistent naming is applying deterministic reverse-engineering scaffolding, which structures entity models and DbContext generation using customizable templates and pluggable providers.

Can I use custom templates with EF Core reverse-engineering scaffolding?

Yes, EF Core reverse-engineering scaffolding supports customizable templates and pluggable providers through its pipeline, allowing you to align generated entity models and DbContext structure with specific project complexity requirements.

Does EF Core scaffolding work with pluggable database providers?

EF Core scaffolding works with pluggable providers by utilizing IDatabaseModelFactory within the reverse-engineering pipeline, ensuring tooling compatibility across varying database schemas and project complexities.

Why is reverse-engineering a database schema to EF Core models error prone?

Reverse-engineering a database schema to EF Core models is error prone due to structural complexity, which this scaffolding pipeline mitigates by enforcing a deterministic process through IScaffoldingModelFactory and IModelCodeGenerator.

When do I need to use EF Core reverse-engineering scaffolding for my project?

You need to use EF Core reverse-engineering scaffolding when onboarding legacy databases to EF Core, ensuring deterministic generation of DbContext and entity models from an existing database schema using compatible tooling.