Back to articles
Why you should abstract EF's DBContext
NewsDevOps

Why you should abstract EF's DBContext

via Dev.toPaulo Pozeti

Every article, old or new, about Entity Framework tells you the same thing: DbContext is already a Unit of Work, DbSet is already a Repository, and if you abstract over them you're just creating abstraction over abstraction. I think they're answering the wrong question. Others say you should only do if the app is big or logic is complex. I think it doesn't matter the size of your organization or product! You should always abstract infrastructure. Let's see if I can convince you. Current misconception If you search right now about EF DBContext Repository Pattern, you are likely to find the following: Argues that DbContext is already a Unit of Work and DbSet is already a Repository. Adding another layer is redundant abstraction over abstraction. — Gunnar Peipman A thorough analysis concluding that the traditional repository pattern adds complexity without benefit — Jon P Smith (The Reformed Programmer) The Repository Pattern is Dead. EF Core Killed It. — Yaseer Arafat Discusses how devel

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles