Oct 052011
 

In one of my recent projects I have reached the need to validate that I have all dependencies correctly registered in my UnityContainer. For those that are not familiar with Unity, it is a dependency injection container that allows constructor, property and method call dependency injection.

You can get more information about how Unity works and also download the latest release from Codeplex: http://unity.codeplex.com/

Shout it

 

Continue reading »

Feb 122011
 

 

In this blog post I am presenting a simple validation framework that you can reuse in your code. Also I will be putting here two code snippets that will make it easier for you to add preconditions to your code.

When Visual Studio 2010 was first realeased, one of the features that I expected the most was code contracts. Unfortunately after including them in one of my large projects, it became more clear that at this moment it is not mature enough to be used. Build time increases rapidly when having a lot of source code files and using the code contracts. Enabling static contract validation is even worse, almost doubling the build time on an average development machine.

All that being said, I really like the code contracts way of specifying preconditions. Most of the time I don’t use post-conditions, but being able to specify validation criteria means that the code will be more robust.

Continue reading »