Agent skill
dotnet-entity-framework6
Maintain or migrate EF6-based applications with realistic guidance on what to keep, what to modernize, and when EF Core is or is not the right next step. Use when working in an EF6 codebase or planning a data layer migration.
Install this agent skill to your Project
npx add-skill https://github.com/managedcode/dotnet-skills/tree/main/catalog/Frameworks/Entity-Framework-6/skills/dotnet-entity-framework6
SKILL.md
Entity Framework 6
Trigger On
- working in an EF6 codebase on .NET Framework or modern .NET
- deciding whether to keep EF6, move to modern .NET runtime, or port to EF Core
- reviewing EDMX, code-first, or legacy ASP.NET/WPF/WinForms data access
- planning a data layer migration strategy
Workflow
-
Audit current EF6 usage before planning any migration. Identify which features the codebase depends on:
csharp// Common EF6-specific patterns to inventory: // - EDMX designer models (check for *.edmx files) // - ObjectContext vs DbContext usage // - Lazy loading with virtual navigation properties // - Database.SqlQuery<T>() for raw SQL // - Stored procedure mappings in model // - Spatial types (DbGeography, DbGeometry) -
Decide runtime vs ORM migration separately:
Path When to use Keep EF6 on .NET Framework Legacy app with no runtime pressure EF6 on modern .NET Runtime upgrade needed, ORM migration too risky EF6 → EF Core Clean data layer, no EDMX, minimal stored-procedure mapping -
For maintenance work — keep EF6 stable:
- use repository + unit of work patterns to isolate data access (see references/patterns.md)
- prefer
DbContextoverObjectContextfor new code - use
AsNoTracking()for read-only queries - configure concurrency tokens with
[ConcurrencyCheck]orIsRowVersion()
-
For migration work — validate each slice:
- map EF6 features to EF Core equivalents (see references/migration.md)
- migrate one bounded context at a time, not the entire data layer
- run integration tests against the real database provider, not InMemory
- verify:
dotnet ef migrations addsucceeds, queries produce equivalent results, lazy loading behavior matches expectations
-
Do not promise EF Core features to EF6 codebases — EF6 is stable and supported but not on the innovation path. Keep expectations realistic.
flowchart LR
A["Audit EF6 usage"] --> B{"EDMX or complex mappings?"}
B -->|Yes| C["High migration cost — consider keeping EF6"]
B -->|No| D["Evaluate EF Core migration"]
D --> E["Migrate one context at a time"]
E --> F["Integration test against real DB"]
C --> G["Modernize runtime only"]
F --> H["Validate query equivalence"]
G --> H
Deliver
- realistic EF6 maintenance or migration guidance based on actual codebase audit
- clear separation between runtime upgrade and ORM upgrade work
- bounded migration slices with concrete validation checkpoints
- reduced risk for legacy data access changes
Validate
- EF6 feature inventory is complete before migration planning starts
- migration assumptions are backed by real feature usage, not guesses
- EF6-only features (EDMX, spatial types, ObjectContext patterns) are identified early
- integration tests run against the real database provider, not mocks or InMemory
- the proposed path avoids unnecessary churn in stable data access code
References
- references/migration.md - decision framework, migration approaches, EF6-to-EF Core feature mapping, and common pitfalls
- references/patterns.md - repository and unit of work patterns, query optimization, concurrency handling, auditing, and testing strategies for EF6 codebases
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dotnet-project-setup
Create or reorganize .NET solutions with clean project boundaries, repeatable SDK settings, and a maintainable baseline for libraries, apps, tests, CI, and local development.
csharp-scripts
Run single-file C# programs as scripts (file-based apps) for quick experimentation, prototyping, and concept testing. Use when the user wants to write and execute a small C# program without creating a full project.
dotnet-pinvoke
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.
nuget-trusted-publishing
Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet/login, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.
dotnet-legacy-aspnet
Maintain classic ASP.NET applications on .NET Framework, including Web Forms, older MVC, and legacy hosting patterns, while planning realistic modernization boundaries.
dotnet-code-review
Review .NET changes for bugs, regressions, architectural drift, missing tests, incorrect async or disposal behavior, and platform-specific pitfalls before you approve or merge them.
Didn't find tool you were looking for?