Mid EF Core

Should you use a generic repository?

What are the trade-offs?

  • Generic repository provides CRUD for all entity types.
  • Advantages:
  • Reusable and reduces boilerplate.
  • Simple for basic CRUD.
  • Disadvantages:
  • Can become too generic, losing flexibility for complex queries.
  • May leak EF Core specifics or cause over-abstraction.
  • Sometimes custom repositories per aggregate are better.

More from Entity Framework Core Tutorial

All questions for this course