migrating-ef-dbcontext

Migrate Entity Framework DbContext registrations to ASP.NET Core dependency injection.

19|2|Updated May 13, 2026
One-click install
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-ef-dbcontext
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrating-ef-dbcontext
Source: https://github.com/microsoft/upgrade-agent-plugins/tree/main/plugins/upgrade-agent/extenders/upgrade-dotnet/upgrade/skills/lazy/data/migrating-ef-dbcontext
Command: npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-ef-dbcontext

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of migrating Entity Framework DbContext registrations from legacy ASP.NET patterns to ASP.NET Core's dependency injection in Program.cs, supporting both EF6 and EF Core.

Core Features & Use Cases

  • DbContext Registration: Handles registration of DbContext in Program.cs for both EF6 and EF Core.
  • Connection String Migration: Moves connection strings from web.config/app.config to appsettings.json.
  • Database Initialization: Migrates database initialization and seeding logic to Program.cs.
  • Use Case: Ideal for upgrading ASP.NET to ASP.NET Core projects that require DbContext migration and connection string management.

Quick Start

Migrate DbContext registration for your project to ASP.NET Core using the migrating-ef-dbcontext skill.

Frequently Asked Questions about migrating-ef-dbcontext

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

FAQPage Schema
How do I migrate Entity Framework DbContext to ASP.NET Core dependency injection?

Migrating Entity Framework DbContext to ASP.NET Core dependency injection involves moving registrations from Global.asax or Startup to Program.cs. This Skill automates that DbContext registration, supporting both EF6 and EF Core frameworks.

Can I move connection strings from web.config to appsettings.json during ASP.NET Core migration?

Yes, moving connection strings from web.config or app.config to appsettings.json is supported. This Skill handles connection string migration alongside DbContext registration to ensure proper configuration in ASP.NET Core.

Does this migration approach support both EF6 and EF Core DbContext?

Yes, this DbContext migration approach supports both EF6 and EF Core. It handles dependency injection registration in Program.cs for either framework when upgrading legacy ASP.NET projects to ASP.NET Core.

How do I migrate database initialization and seeding logic to ASP.NET Core?

Migrating database initialization and seeding logic to ASP.NET Core requires moving this code to Program.cs. This Skill automates that migration, ensuring your database initializer runs correctly within the new dependency injection container.

What is the best way to upgrade an ASP.NET project to ASP.NET Core with existing DbContext usage?

The best way to upgrade ASP.NET to ASP.NET Core with existing DbContext usage is automating the migration of DbContext registrations, connection strings, and database seeding logic to Program.cs. This Skill streamlines that entire process.