Today I attended an excellent workshop about Scala development held by Ted Neward. During the session Ted demonstrated a different, functional, aspect of the Inversion of Control concept which he illustrated in Scala. Since it’s fully possible to do the same thing in C# I thought would borrow and modify his example to show a different type of Inversion of Control.
An introduction to Inversion of Control, using the Dependency Injection and Service Locator patterns, along with simple examples in C#.
Out of the five SOLID principles the Open/Closed Principle is probably the one that I’ve had the hardest time understanding. However, a while ago though I found some code that I had written years ago that made me think to myself “Hey, this is clearly violating the Open Closed Principle!”.
I recently began working on the new version of this blog which will be built with ASP.NET MVC. One of the first things I set out to do was to implement a custom controller factory which uses the IoC container StructureMap to resolve dependencies and instantiate controllers.