Monday, November 21, 2011

TDD Adventure: Repository Newb

Forcing myself to use Test Driven Development is teaching me more than expected. Last year I learned about Entity Framework and the ease it brings to developers who want to focus on functionality. I created a project with it, and looking back on the code now it looks very much 'rookie'. I have matured quite a bit with the idea of context.

Recently with a new idea for another project I want to tackle TDD this time. Being experienced with Entity Framework I still felt like I was making hard coded database calls in the controllers. It wasn't really hard coded database procedures, but it was direct expressions against the entity object set. I feel really newb saying this, but I heard talk and would read about this 'repository' class. But didn't fully understand it and what it was for.

Just going through this tutorial twice, once as exampled and the second using my project. I could almost hear the light bulb click on. Repositories are the place for all the Linq code which could be SQL or even calls to stored procedures. And using a fakeObjectSet as the context really sets me up for the way I approach projects and allowing me to also start my newest project with TDD.

No comments:

Post a Comment