Brian Di Croce
1 min readFeb 11, 2020

--

Great tutorial on how to properly separate responsabilities amongst various cohesive set of objects.

I agree with the other comments about not encapsulating the DbContext in a Repository/UofW pattern, because it’s just creating an unecessary abstraction that will hinder performance amongst other things.

If you’re using EF Core and .NET, those are not just libraries, but frameworks, so it’s okay to use them as they are without adding more abstractions on top of them. EF Core provides you with entity tracking which you might want to use or not for performance issues, so you’re already losing that nice advantage provided by the framework.

One last note, one might also consider returning IQueryable<T> instead of IEnumerable<T> if going with that Repository pattern, so as to not hinder performance, i.e., you can limit the range of data to fetch from the database quickly by using LINQ.

By the way, I love the way you’ve structured your article in various parts that deals with each different layer. I wish more technical articles were written like this one. Keep up the good work! :)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Brian Di Croce
Brian Di Croce

Written by Brian Di Croce

I’m a software engineer based in Montreal, Canada, and the founder of Cloudgenda. I tweet at https://twitter.com/bdicroce. 🍁

Responses (1)

Write a response