Tuesday, July 31, 2018

Post-Mortem: Using the Repository Pattern With Entity Framework

Dear all future developers who may get stuck dealing with a couple of applications I've written over the past year or so.  I know that much future cursing at me is on the way.  Much to my regret, I confess I used repositories with Entity Framework Code-First.

...and I didn't just use one or two,  I added at least four or five -- on top of a BASE repository.  To make it worse, I even created a BaseController to deal with all this so that now I have inheriting controllers that have to deal with ramifications. 

The severity of the above could have been significantly reduced if I had written proper unit tests.  In one app, I actually DID write (improper -- with very little mocking) unit tests first but because the tests now need to run on an independent build server, I have to suffer to re-write them quickly to meet a deadline but, the reality is, the apps need re-architecture.   

I'm working on a prototype with better architecture  but that will probably not have time to go through the the whole integration testings, etc. 

Thanks @hoagieland for your post.  It might be a little extreme but with many valid points.

All who have to deal with this particular flavor should read:


You’re All Doing Entity Framework Wrong

No comments:

Post a Comment