-
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 of the issues we can run into...
-
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 Handle(TEvent args); } It’s a pattern with...
-
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 to emerge. We have some interface...
-
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 bunch of people that use it, so I gave it a whirl. My original Windsor configuration...
-
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 visible so it serves as a good whipping boy. Tim Barcz...
-
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 approach the problem. The goal We want a configuration...
-
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 to full-on DI, but not quite far enough. Here...
-
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 up so neatly with the concept being explained that the student may have trouble recognizing...
-
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 was feeling the pain because doing it all wrong. And just a month or so ago, I had the...
-
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 it using StructureMap. Here's my goal: 1. Request a concrete type of an interface...
-
Looks like StructureMap 2.5 dropped this weekend. Which is nice, as we’ve been running off of the trunk for around six months. On a side note, I never really *openly* mocked the release as the Duke Nukem Forever release, just some friendly banter on the Twitter, some local lunches, maybe at a conference...
-
This behavior is probably clearly specified somewhere, but somehow it has been non-obvious to the four people on our team to the point that we were leaning toward banning its use. I didn’t want to go that far, so figured I better figure out the rules. I’m referring to the AssertWasCalled extension method...
-
Following many examples I found online for other IoC containers, I borrowed utilized those designs to create a StructureMap instance provider . One problem we ran into with that design was dealing with NHibernate. Mainly, there are two types that are very important to care about when using NHibernate...
-
So Derick Bailey asked me the other day a few weeks ago to describe how we use our IoC container. I wouldn't call it "best practices", though some of these tips came from the creator of our container of choice, StructureMap (Jeremy Miller). Although IoC containers are everywhere these days...
-
Although it was possible in previous versions of StructureMap, the new fluent interface for StructureMap configuration in version 2.5 allows easy configuration of array type constructor parameters. For example, consider a simple order processor pipeline: public class OrderPipeline { private readonly...