ef-core

Installation
Summary

Entity Framework Core best practices guide covering design, performance, security, and testing patterns.

  • Covers eight core areas: DbContext design, entity modeling, performance optimization, migrations, querying strategies, change tracking, security, and testing approaches
  • Emphasizes practical patterns like DbContextFactory, IEntityTypeConfiguration separation, AsNoTracking() for read-only queries, and compiled queries for frequently executed operations
  • Includes migration best practices such as descriptive naming, SQL verification before production, and data seeding through migrations
  • Addresses common pitfalls: N+1 query problems, SQL injection prevention, appropriate DbContext lifetimes, and concurrency control for multi-user scenarios
  • Recommends testing strategies using in-memory providers for unit tests and SQLite for integration tests
SKILL.md

Entity Framework Core Best Practices

Your goal is to help me follow best practices when working with Entity Framework Core.

Data Context Design

  • Keep DbContext classes focused and cohesive
  • Use constructor injection for configuration options
  • Override OnModelCreating for fluent API configuration
  • Separate entity configurations using IEntityTypeConfiguration
  • Consider using DbContextFactory pattern for console apps or tests

Entity Design

  • Use meaningful primary keys (consider natural vs surrogate keys)
  • Implement proper relationships (one-to-one, one-to-many, many-to-many)
  • Use data annotations or fluent API for constraints and validations
  • Implement appropriate navigational properties
  • Consider using owned entity types for value objects
Related skills

More from github/awesome-copilot

Installs
8.7K
GitHub Stars
32.7K
First Seen
Feb 25, 2026