StructureMap: Interlude
I’m trying to wrap up the “StructureMap: Advanced Scenarios Usage” post. In the meantime, I wanted to make you aware of a few things:
- I just updated my StructureMap: Basic Scenario Usage post with a correction. I was mistaken about being able to set properties on configured objects. Currently, you cannot configure properties on configured objects unless the property has the [SetterProperty] attribute defined. This was on purpose since there is a good argument that property injection is ‘bad’ (i.e. leads to problems later, can complicate configuration and testing, etc). There are, however, scenarios where property injection is acceptable so being able to configure properties without using the attribute is being seriously considered for the StructureMap 2.5 release.
- Derik Whitaker posted about how to use StructureMap in an MSTest situation to work around some of MSTest’s quirks. He used StructureMap’s ability to configure itself through XML in your web.config/app.config file rather than having a separate XML file. Or you could, of course, save half your time and tons of complexity and just use NUnit/MBUnit/XUnit and not deal with the hassle. But it’s good for those people required to use MSTest to still be able to take advantage of StructureMap.
- You should know that Joshua Flanagan was the one who contributed that feature (the app.config configuration stuff) to StructureMap which is useful for a variety of reasons — not just the MSTest reason. The reason you should know of him is because…
- The same Joshua just posted a great post on how to get started from the most basic level with StructureMap. It’s a “Hello World” type app, but shows off some of the ways StructureMap works. Of course it’s overdone as a Hello World app, but that wasn’t the point. The point is to show how to get started with StructureMap and I think it does a really good job at that.