June 2010 Blog Posts
Index Part 0 – Introduction Part 1 – The Basics Part 2 – Instance Lifecycles Part 3 – Constructing the Concrete Type Part 4 - Scanning Now that we can control the lifecycle of an instance it’s worth considering how those instances are constructed. In the code shown so far the parameter-less Use method is responsible for specifying the concrete...
Index Part 0 – Introduction Part 1 – The Basics Part 2 – Instance Lifecycles Part 3 – Constructing the Concrete Type Part 4 - Scanning So far I’ve shown how to do basic registration. This will let the container know of the type so that it will try to create it. This registration gives us the defaults that StructureMap...
Index Part 0 – Introduction Part 1 – The Basics Part 2 – Instance Lifecycles Part 3 – Constructing the Concrete Type Part 4 - Scanning Let’s start at the beginning which is allegedly a very good place to start. Before StructureMap can construct any kind of concrete type for you it must be told what it should construct. StructureMap...
Dependency Injection is a shamefully under-utilised practice in .NET development. There’s really little excuse for this as there are a number of serviceable frameworks available. These include Castle Windsor (http://www.castleproject.org/container/index.html), Spring.NET (http://www.springframework.net/) or even Unity (http://unity.codeplex.com/) if you’re stuck at a Microsoft-only shop. However my personal preference is StructureMap (http://structuremap.github.com/structuremap/) which has a number of features that I like: Simple deployment There’s a single StructureMap assembly to be referenced and it’s rare to encounter a situation where you need multiple incompatible versions. Minimally intrusive StructureMap doesn’t require the use of attributes, marker...