Why Repository design pattern is not good with Entity Framework RRS feed


  • I don't use either the Repository or UoW pattern period when I have complete control of developing the solution for data persistence. I worked on projects where the patterns were implemented, and I just didn't like the patterns.  I like to keep it plain, straightforward and simple. And the simpler the better.

    There is no junk up in any MVC or Web API controller dealing with EF directly.  And Repository or UoW is not being used in a SOA solution using a legacy Web service or any form of a WCF service where the DAL is sitting behind the service.

    The bottom line is I always implement SoC (Separation of Concerns) by using a DAL, and the DAL is using the DAO pattern, which gives me complete control. The DAO object can be using an ORM like EF, nHhibernate or just straight up ADO.NET with DB command objects. And DAO objects can call other DAO objects as needed for CRUD operations with the DB. The DAO(s) have the control, period.

    Thursday, November 26, 2015 4:56 PM