Category Archives: StructureMap

Advanced StructureMap: Diagnosing problems

So you’ve set up StructureMap, got all your registries in a row, go to run the application, and you’re greeted by a rather unfortunate message: StructureMap.StructureMapException : StructureMap Exception Code: 202 No Default Instance defined for PluginFamily That’s just one … Continue reading 

| Leave a comment

Advanced StructureMap: custom registration conventions for partially closed types

A while back, I highlighted an issue we ran into where I had basically partially closed generic types.  A common pattern in message- and command-based architectures is the concept of a handler for a message: public interface IHandler<TEvent> { void … Continue reading 

| Leave a comment

Advanced StructureMap: connecting implementations to open generic types

One pattern we’re starting to see more and more is the idea of connecting messages to handlers.  These messages might be domain command messages, ActionResult messages, and more.  Beyond messaging implementations, we start to see a more basic pattern start … Continue reading 

| 13 Comments

Windsor style convention over configuration in StructureMap

So I was trying to get my  BDD project SpecMaker working on Mono only to find out  my usual IoC container of choice Castle Windsor does not play nice.  StructureMap I’ve heard plays nice in Mono, and I know a … Continue reading 

Also posted in Members | Leave a comment

Just say no to ‘Poor Man’s Dependency Injection’.

For background, Jimmy Bogard originally posted about the ‘poor man’s dependency injection’ style used in NerdDinner. Not to single out NerdDinner, because there are lots of apps out there doing this. NerdDinner just happened to be the most recent and … Continue reading 

| 14 Comments

How we handle application configuration

We recently overhauled the way we handle configurable settings within our application (server names, email addresses, polling frequencies, etc) . I’m going to present our solution below, but its new enough that I’d like to hear feedback on how others … Continue reading 

Also posted in Best Practices, Design Principles, Legacy Code, Testing | 8 Comments

How not to do Dependency Injection, in NerdDinner

Checking out the NerdDinner code the other day, I found a common Dependency Injection anti-pattern.  One of the core concepts of DI is that components are not responsible for locating their own dependencies.  The code went part of the way … Continue reading 

| Leave a comment

Real World Refactoring

If you’ve ever asked, or been asked, for an example to illustrate a software design principle, you know how frustrating it can be to work with a contrived example. There is rarely any depth to the example, and it lines … Continue reading 

Also posted in Design Patterns, Design Principles, SOLID, Testing | 6 Comments

Let your Inversion of Control tool work for you

If you are just starting out exploring use of an Inversion of Control tool (IoC), its very easy to go down the wrong path, and make things harder for yourself. Today I had a conversation with a bright developer who … Continue reading 

Also posted in Best Practices, Design Principles, Development, DRY, Legacy Code, SOLID, Testing | 22 Comments

Learning StructureMap Through Tiny Goals

While I’ve been using Castle’s Windsor for a bit now, but wanted to get some StructureMap code running just to get some exposure to it; I’ve heard good things. I decided to set a simple goal and try to achieve … Continue reading 

Also posted in IoC | Leave a comment