Saturday, 31 December 2011

A generic repository

Way back in January I said that I was going to post on a generic repository, due to various other diversions during the year I never managed to get around to completing this work but on the last day of the year it is finally all done and to tick off one of my goals here is the post about it.

What’s it all about?

When talking about both Linq to Sql (L2S) and Entity framework (EF) you will frequently hear developers saying that they will be using a repository to encapsulate the ORM interactions, what this means in practice is hiding the actual ORM functions and providing a abstract class or interface you can mock to make it easier to test your applications.

Tuesday, 6 December 2011

A S.O.L.I.D data access layer

A while back I had reason to look at one of my assemblies in my “toolbox” which wrapped the System.Data.SqlClient assembly and as often happens when you look at old code you cringe and wonder what you were thinking when you wrote it, so I decided to refactor the code using S.O.L.I.D principles to make the code easier to understand, test, maintain and extend and so ADO.NET DAL was born.

For those of you who follow on me on Twitter you’ll know I spent a long time trying to ensure that the library had 100% code coverage but unfortunately I never made it, one method still eludes me but 99% coverage is pretty good Smile.