by Mikael Henriksson
11. June 2010 00:31
This post is part of a series and the source code can be found at http://github.com/MikaelHenrixon/ConqueringNServiceBus
- Conquering NServiceBus part 1 – Getting Started
- Conquering NServiceBus part 2 – Initial configuration
- Conquering NServiceBus part 3 – A simple Saga
- Conquering NServiceBus part 4 – Testing
- Conquering NServiceBus part 5 – Troubleshooting DTC
- Conquering NServiceBus part 6 – Upgrading StructureMap
I mentioned somewhere that I had to change the StructureMap ObjectBuilder a tiny bit to be able to upgrade and make use of the new API goodness that Jeremy and Joshua had created.
It’s all really simple, I just lifted out the whole project “x:\NServiceBus\src\impl\ObjectBuilder\ObjectBuilder.StructureMap” and made that project a part of my own solution file. I probably don’t have to do that but I did not want to risk accidently overwriting or deleting my changes.
There are only two steps necessary:
- Upgrade StructureMap.dll to the newest version (currently 2.6.1)
- Inside StructureMapObjectBuilder.cs replace:
configuredInstance = x.ForRequestedType(component)
.CacheBy(scope)
.TheDefaultIsConcreteType(component);
with the following
configuredInstance = x.For(component)
.LifecycleIs(scope)
.Use(component);
It’s not even necessary to do this change, a simple replace of the StructureMap.dll in the external-bin folder of the NServiceBus source code should do the trick. It’s been ages ago since I submitted the patch for this but it did not make the 2.0. Starting from the trunk onwards the upgrade should not be necessary.
Now it’s bed time since hours ago :)